@@ -19,8 +19,8 @@ |
||
19 | 19 | // or an uncoditional redirect to this file or copy groupdav.htaccess to your docroot as .htaccess |
20 | 20 | if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND' || $_SERVER['REQUEST_METHOD'] == 'OPTIONS') |
21 | 21 | { |
22 | - header('Location: groupdav.php/'); |
|
23 | - exit; |
|
22 | + header('Location: groupdav.php/'); |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // forward for not existing or empty header to setup |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | // forward for not existing or empty header to setup |
23 | -if(!file_exists('header.inc.php') || !filesize('header.inc.php')) |
|
23 | +if (!file_exists('header.inc.php') || !filesize('header.inc.php')) |
|
24 | 24 | { |
25 | 25 | Header('Location: setup/index.php'); |
26 | 26 | exit; |
27 | 27 | } |
28 | 28 | |
29 | -if(isset($_GET['hasupdates']) && $_GET['hasupdates'] == 'yes') |
|
29 | +if (isset($_GET['hasupdates']) && $_GET['hasupdates'] == 'yes') |
|
30 | 30 | { |
31 | 31 | $hasupdates = True; |
32 | 32 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | /* |
35 | 35 | This is the menuaction driver for the multi-layered design |
36 | 36 | */ |
37 | -if(isset($_GET['menuaction']) && preg_match('/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/',$_GET['menuaction'])) |
|
37 | +if (isset($_GET['menuaction']) && preg_match('/^[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+$/', $_GET['menuaction'])) |
|
38 | 38 | { |
39 | - list($app,$class,$method) = explode('.',$_GET['menuaction']); |
|
40 | - if(! $app || ! $class || ! $method) |
|
39 | + list($app, $class, $method) = explode('.', $_GET['menuaction']); |
|
40 | + if (!$app || !$class || !$method) |
|
41 | 41 | { |
42 | 42 | $invalid_data = True; |
43 | 43 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $invalid_data = True; |
49 | 49 | } |
50 | 50 | //error_log(__METHOD__."$app,$class,$method"); |
51 | -if($app == 'phpgwapi') |
|
51 | +if ($app == 'phpgwapi') |
|
52 | 52 | { |
53 | 53 | $app = 'home'; |
54 | 54 | $api_requested = True; |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | include('./header.inc.php'); |
65 | 65 | // check if users are supposed to change their password every x sdays, then check if password is of old age or the devil-admin reset the users password |
66 | 66 | // and forced the user to change his password on next login. |
67 | -auth::check_password_age($app,$class,$method); |
|
67 | +auth::check_password_age($app, $class, $method); |
|
68 | 68 | |
69 | 69 | // user changed timezone |
70 | 70 | if (isset($_GET['tz'])) |
71 | 71 | { |
72 | - egw_time::setUserPrefs($_GET['tz']); // throws exception, if tz is invalid |
|
72 | + egw_time::setUserPrefs($_GET['tz']); // throws exception, if tz is invalid |
|
73 | 73 | |
74 | - $GLOBALS['egw']->preferences->add('common','tz',$_GET['tz']); |
|
74 | + $GLOBALS['egw']->preferences->add('common', 'tz', $_GET['tz']); |
|
75 | 75 | $GLOBALS['egw']->preferences->save_repository(); |
76 | 76 | |
77 | 77 | if (($referer = common::get_referer())) |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | |
83 | 83 | // Check if we are using windows or normal webpage |
84 | 84 | $windowed = false; |
85 | -$tpl_info = EGW_SERVER_ROOT . '/phpgwapi/templates/' . basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php'; |
|
85 | +$tpl_info = EGW_SERVER_ROOT.'/phpgwapi/templates/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']).'/setup/setup.inc.php'; |
|
86 | 86 | if (!file_exists($tpl_info)) |
87 | 87 | { |
88 | - $tpl_info = EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) . '/setup/setup.inc.php'; |
|
88 | + $tpl_info = EGW_SERVER_ROOT.'/'.basename($GLOBALS['egw_info']['user']['preferences']['common']['template_set']).'/setup/setup.inc.php'; |
|
89 | 89 | } |
90 | -if(@file_exists($tpl_info)) |
|
90 | +if (@file_exists($tpl_info)) |
|
91 | 91 | { |
92 | 92 | include_once($tpl_info); |
93 | - if($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed']) |
|
93 | + if ($GLOBALS['egw_info']['template'][$GLOBALS['egw_info']['user']['preferences']['common']['template_set']]['windowed']) |
|
94 | 94 | { |
95 | 95 | $windowed = true; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | 99 | |
100 | -if($app == 'home' && !$class && !$api_requested && !($windowed && $_GET['cd'] == 'yes' && !html::$ua_mobile)) |
|
100 | +if ($app == 'home' && !$class && !$api_requested && !($windowed && $_GET['cd'] == 'yes' && !html::$ua_mobile)) |
|
101 | 101 | { |
102 | 102 | if ($GLOBALS['egw_info']['server']['force_default_app'] && $GLOBALS['egw_info']['server']['force_default_app'] != 'user_choice') |
103 | 103 | { |
104 | 104 | $GLOBALS['egw_info']['user']['preferences']['common']['default_app'] = $GLOBALS['egw_info']['server']['force_default_app']; |
105 | 105 | } |
106 | - if($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) |
|
106 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['default_app'] && !$hasupdates) |
|
107 | 107 | { |
108 | - egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']),$GLOBALS['egw_info']['user']['preferences']['common']['default_app']); |
|
108 | + egw::redirect(egw_framework::index($GLOBALS['egw_info']['user']['preferences']['common']['default_app']), $GLOBALS['egw_info']['user']['preferences']['common']['default_app']); |
|
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | -if($windowed && $_GET['cd'] == 'yes') |
|
116 | +if ($windowed && $_GET['cd'] == 'yes') |
|
117 | 117 | { |
118 | 118 | $GLOBALS['egw_info']['flags'] = array( |
119 | 119 | 'noheader' => False, |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | } |
126 | 126 | else |
127 | 127 | { |
128 | - if($api_requested) |
|
128 | + if ($api_requested) |
|
129 | 129 | { |
130 | 130 | $app = 'phpgwapi'; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $obj = CreateObject($app.'.'.$class); |
134 | - if((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data) |
|
134 | + if ((is_array($obj->public_functions) && $obj->public_functions[$method]) && !$invalid_data) |
|
135 | 135 | { |
136 | 136 | $obj->$method(); |
137 | 137 | unset($app); |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
145 | - if(!$app || !$class || !$method || $invalid_data) |
|
145 | + if (!$app || !$class || !$method || $invalid_data) |
|
146 | 146 | { |
147 | - if(@is_object($GLOBALS['egw']->log)) |
|
147 | + if (@is_object($GLOBALS['egw']->log)) |
|
148 | 148 | { |
149 | 149 | $GLOBALS['egw']->log->message(array( |
150 | 150 | 'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1', |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - if(!is_array($GLOBALS[$class]->public_functions) || !$GLOBALS[$class]->public_functions[$method] && $method) |
|
158 | + if (!is_array($GLOBALS[$class]->public_functions) || !$GLOBALS[$class]->public_functions[$method] && $method) |
|
159 | 159 | { |
160 | - if(@is_object($GLOBALS['egw']->log)) |
|
160 | + if (@is_object($GLOBALS['egw']->log)) |
|
161 | 161 | { |
162 | 162 | $GLOBALS['egw']->log->message(array( |
163 | 163 | 'text' => 'W-BadmenuactionVariable, attempted to access private method: %1', |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | )); |
168 | 168 | } |
169 | 169 | } |
170 | - if(@is_object($GLOBALS['egw']->log)) |
|
170 | + if (@is_object($GLOBALS['egw']->log)) |
|
171 | 171 | { |
172 | 172 | $GLOBALS['egw']->log->commit(); |
173 | 173 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $GLOBALS['egw']->redirect_link('/home/index.php'); |
176 | 176 | } |
177 | 177 | |
178 | - if(!isset($GLOBALS['egw_info']['nofooter'])) |
|
178 | + if (!isset($GLOBALS['egw_info']['nofooter'])) |
|
179 | 179 | { |
180 | 180 | common::egw_footer(); |
181 | 181 | } |
@@ -14,16 +14,16 @@ |
||
14 | 14 | $setup_info['infolog']['name'] = 'infolog'; |
15 | 15 | $setup_info['infolog']['version'] = '16.1'; |
16 | 16 | $setup_info['infolog']['app_order'] = 5; |
17 | -$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra'); |
|
17 | +$setup_info['infolog']['tables'] = array('egw_infolog', 'egw_infolog_extra'); |
|
18 | 18 | $setup_info['infolog']['enable'] = 1; |
19 | -$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true'; |
|
19 | +$setup_info['infolog']['index'] = 'infolog.infolog_ui.index&ajax=true'; |
|
20 | 20 | |
21 | 21 | $setup_info['infolog']['author'] = |
22 | 22 | $setup_info['infolog']['maintainer'] = array( |
23 | 23 | 'name' => 'Ralf Becker', |
24 | 24 | 'email' => '[email protected]' |
25 | 25 | ); |
26 | -$setup_info['infolog']['license'] = 'GPL'; |
|
26 | +$setup_info['infolog']['license'] = 'GPL'; |
|
27 | 27 | $setup_info['infolog']['description'] = |
28 | 28 | '<p><b>CRM</b> (customer-relation-management) type app using Addressbook providing |
29 | 29 | Todo List, Notes and Phonelog. <b>InfoLog</b> is orininaly based on eGroupWare\'s |
@@ -47,11 +47,11 @@ |
||
47 | 47 | /* Dependencies for this app to work */ |
48 | 48 | $setup_info['admin']['depends'][] = array( |
49 | 49 | 'appname' => 'phpgwapi', |
50 | - 'versions' => Array('14.1') |
|
50 | + 'versions' => array('14.1') |
|
51 | 51 | ); |
52 | 52 | $setup_info['admin']['depends'][] = array( |
53 | 53 | 'appname' => 'etemplate', |
54 | - 'versions' => Array('14.1') |
|
54 | + 'versions' => array('14.1') |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 |
@@ -14,53 +14,53 @@ |
||
14 | 14 | $phpgw_baseline = array( |
15 | 15 | 'egw_infolog' => array( |
16 | 16 | 'fd' => array( |
17 | - 'info_id' => array('type' => 'auto','nullable' => False,'comment' => 'id of the infolog-entry'), |
|
18 | - 'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task','comment' => 'infolog-type e.g. task, phone, email or note'), |
|
19 | - 'info_from' => array('type' => 'varchar','precision' => '255','comment' => 'text of the primary link'), |
|
20 | - 'info_addr' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for phone-number or email of the primary contact'), |
|
21 | - 'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'), |
|
22 | - 'info_des' => array('type' => 'text','comment' => 'desciption of the infolog-entry'), |
|
23 | - 'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'), |
|
24 | - 'info_responsible' => array('type' => 'ascii','meta' => 'account-commasep','precision' => '255','nullable' => False,'default' => '0','comment' => 'responsible users or groups (multiple)'), |
|
25 | - 'info_access' => array('type' => 'ascii','precision' => '10','default' => 'public','comment' => 'public or privat'), |
|
26 | - 'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'), |
|
27 | - 'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'), |
|
28 | - 'info_startdate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the startdate'), |
|
29 | - 'info_enddate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the enddate'), |
|
30 | - 'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the parent infolog'), |
|
31 | - 'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: planned time'), |
|
32 | - 'info_replanned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: replanned time'), |
|
33 | - 'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: used time'), |
|
34 | - 'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done','comment' => 'status e.g. ongoing, done ...'), |
|
35 | - 'info_confirm' => array('type' => 'ascii','precision' => '10','default' => 'not'), |
|
36 | - 'info_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'account id of the last modifier'), |
|
37 | - 'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the primary link'), |
|
38 | - 'info_priority' => array('type' => 'int','precision' => '2','default' => '1','comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'), |
|
39 | - 'pl_id' => array('type' => 'int','precision' => '4','comment' => 'pm-field: id of the pricelist'), |
|
40 | - 'info_price' => array('type' => 'float','precision' => '8','comment' => 'pm-field: price-field'), |
|
41 | - 'info_percent' => array('type' => 'int','meta' => 'percent','precision' => '2','default' => '0','comment' => 'percentage of completion'), |
|
42 | - 'info_datecompleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of completion'), |
|
43 | - 'info_location' => array('type' => 'varchar','precision' => '255','comment' => 'textfield location'), |
|
44 | - 'info_custom_from' => array('type' => 'int','precision' => '1','comment' => 'tick-box to show infolog_from'), |
|
45 | - 'info_uid' => array('type' => 'ascii','precision' => '128','comment' => 'unique id of the infolog-entry'), |
|
46 | - 'info_cc' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for email-adress to be notified via email of changes'), |
|
47 | - 'caldav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CalDAV URL, if specified by client'), |
|
48 | - 'info_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag, not yet used'), |
|
49 | - 'info_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation date'), |
|
50 | - 'info_creator' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the creator') |
|
17 | + 'info_id' => array('type' => 'auto', 'nullable' => False, 'comment' => 'id of the infolog-entry'), |
|
18 | + 'info_type' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False, 'default' => 'task', 'comment' => 'infolog-type e.g. task, phone, email or note'), |
|
19 | + 'info_from' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'text of the primary link'), |
|
20 | + 'info_addr' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield for phone-number or email of the primary contact'), |
|
21 | + 'info_subject' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'title of the infolog-entry'), |
|
22 | + 'info_des' => array('type' => 'text', 'comment' => 'desciption of the infolog-entry'), |
|
23 | + 'info_owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'comment' => 'owner of the entry, can be account or group'), |
|
24 | + 'info_responsible' => array('type' => 'ascii', 'meta' => 'account-commasep', 'precision' => '255', 'nullable' => False, 'default' => '0', 'comment' => 'responsible users or groups (multiple)'), |
|
25 | + 'info_access' => array('type' => 'ascii', 'precision' => '10', 'default' => 'public', 'comment' => 'public or privat'), |
|
26 | + 'info_cat' => array('type' => 'int', 'meta' => 'category', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'category id'), |
|
27 | + 'info_datemodified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'timestamp of the last mofification'), |
|
28 | + 'info_startdate' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'timestamp of the startdate'), |
|
29 | + 'info_enddate' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'timestamp of the enddate'), |
|
30 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'id of the parent infolog'), |
|
31 | + 'info_planned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: planned time'), |
|
32 | + 'info_replanned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: replanned time'), |
|
33 | + 'info_used_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'pm-field: used time'), |
|
34 | + 'info_status' => array('type' => 'varchar', 'precision' => '40', 'default' => 'done', 'comment' => 'status e.g. ongoing, done ...'), |
|
35 | + 'info_confirm' => array('type' => 'ascii', 'precision' => '10', 'default' => 'not'), |
|
36 | + 'info_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'account id of the last modifier'), |
|
37 | + 'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'id of the primary link'), |
|
38 | + 'info_priority' => array('type' => 'int', 'precision' => '2', 'default' => '1', 'comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'), |
|
39 | + 'pl_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'pm-field: id of the pricelist'), |
|
40 | + 'info_price' => array('type' => 'float', 'precision' => '8', 'comment' => 'pm-field: price-field'), |
|
41 | + 'info_percent' => array('type' => 'int', 'meta' => 'percent', 'precision' => '2', 'default' => '0', 'comment' => 'percentage of completion'), |
|
42 | + 'info_datecompleted' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'timestamp of completion'), |
|
43 | + 'info_location' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield location'), |
|
44 | + 'info_custom_from' => array('type' => 'int', 'precision' => '1', 'comment' => 'tick-box to show infolog_from'), |
|
45 | + 'info_uid' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'unique id of the infolog-entry'), |
|
46 | + 'info_cc' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'textfield for email-adress to be notified via email of changes'), |
|
47 | + 'caldav_name' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'name part of CalDAV URL, if specified by client'), |
|
48 | + 'info_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag, not yet used'), |
|
49 | + 'info_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'timestamp of the creation date'), |
|
50 | + 'info_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'comment' => 'account id of the creator') |
|
51 | 51 | ), |
52 | 52 | 'pk' => array('info_id'), |
53 | 53 | 'fk' => array(), |
54 | - 'ix' => array('caldav_name',array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')), |
|
54 | + 'ix' => array('caldav_name', array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')), |
|
55 | 55 | 'uc' => array() |
56 | 56 | ), |
57 | 57 | 'egw_infolog_extra' => array( |
58 | 58 | 'fd' => array( |
59 | - 'info_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
60 | - 'info_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '64','nullable' => False), |
|
61 | - 'info_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False) |
|
59 | + 'info_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
60 | + 'info_extra_name' => array('type' => 'varchar', 'meta' => 'cfname', 'precision' => '64', 'nullable' => False), |
|
61 | + 'info_extra_value' => array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False) |
|
62 | 62 | ), |
63 | - 'pk' => array('info_id','info_extra_name'), |
|
63 | + 'pk' => array('info_id', 'info_extra_name'), |
|
64 | 64 | 'fk' => array(), |
65 | 65 | 'ix' => array(), |
66 | 66 | 'uc' => array() |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | function infolog_upgrade0_9_11() |
15 | 15 | { |
16 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified'); |
|
17 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_event_id',array( |
|
16 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_datecreated', 'info_datemodified'); |
|
17 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_event_id', array( |
|
18 | 18 | 'type' => 'int', |
19 | 19 | 'precision' => '4', |
20 | 20 | 'default' => '0', |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | |
28 | 28 | function infolog_upgrade0_9_15_001() |
29 | 29 | { |
30 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_links',array( |
|
30 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_links', array( |
|
31 | 31 | 'fd' => array( |
32 | - 'link_id' => array('type' => 'auto','nullable' => False), |
|
33 | - 'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False), |
|
34 | - 'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
35 | - 'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False), |
|
36 | - 'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
37 | - 'link_remark' => array('type' => 'varchar','precision' => '50','nullable' => True), |
|
38 | - 'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False), |
|
39 | - 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False) |
|
32 | + 'link_id' => array('type' => 'auto', 'nullable' => False), |
|
33 | + 'link_app1' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False), |
|
34 | + 'link_id1' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
35 | + 'link_app2' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False), |
|
36 | + 'link_id2' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
37 | + 'link_remark' => array('type' => 'varchar', 'precision' => '50', 'nullable' => True), |
|
38 | + 'link_lastmod' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
39 | + 'link_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False) |
|
40 | 40 | ), |
41 | 41 | 'pk' => array('link_id'), |
42 | 42 | 'fk' => array(), |
@@ -62,90 +62,90 @@ discard block |
||
62 | 62 | //echo "<p>copying calendar-links: $insert.$select</p>\n"; |
63 | 63 | $GLOBALS['egw_setup']->oProc->query($insert.$select3); |
64 | 64 | |
65 | - $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( |
|
65 | + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array( |
|
66 | 66 | 'fd' => array( |
67 | - 'info_id' => array('type' => 'auto','nullable' => False), |
|
68 | - 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), |
|
69 | - 'info_proj_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
70 | - 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
71 | - 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
72 | - 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
73 | - 'info_des' => array('type' => 'text','nullable' => True), |
|
74 | - 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
75 | - 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
76 | - 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), |
|
77 | - 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
78 | - 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), |
|
79 | - 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
80 | - 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
81 | - 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
82 | - 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), |
|
83 | - 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
84 | - 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
85 | - 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), |
|
86 | - 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'), |
|
87 | - 'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False) |
|
67 | + 'info_id' => array('type' => 'auto', 'nullable' => False), |
|
68 | + 'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False), |
|
69 | + 'info_proj_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
70 | + 'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
71 | + 'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
72 | + 'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
73 | + 'info_des' => array('type' => 'text', 'nullable' => True), |
|
74 | + 'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
75 | + 'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
76 | + 'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'), |
|
77 | + 'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
78 | + 'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
79 | + 'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
80 | + 'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
81 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
82 | + 'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'), |
|
83 | + 'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
84 | + 'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
85 | + 'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'), |
|
86 | + 'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not'), |
|
87 | + 'info_event_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False) |
|
88 | 88 | ), |
89 | 89 | 'pk' => array('info_id'), |
90 | 90 | 'fk' => array(), |
91 | 91 | 'ix' => array(), |
92 | 92 | 'uc' => array() |
93 | - ),'info_addr_id'); |
|
94 | - $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( |
|
93 | + ), 'info_addr_id'); |
|
94 | + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array( |
|
95 | 95 | 'fd' => array( |
96 | - 'info_id' => array('type' => 'auto','nullable' => False), |
|
97 | - 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), |
|
98 | - 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
99 | - 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
100 | - 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
101 | - 'info_des' => array('type' => 'text','nullable' => True), |
|
102 | - 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
103 | - 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
104 | - 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), |
|
105 | - 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
106 | - 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), |
|
107 | - 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
108 | - 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
109 | - 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
110 | - 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), |
|
111 | - 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
112 | - 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
113 | - 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), |
|
114 | - 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'), |
|
115 | - 'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False) |
|
96 | + 'info_id' => array('type' => 'auto', 'nullable' => False), |
|
97 | + 'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False), |
|
98 | + 'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
99 | + 'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
100 | + 'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
101 | + 'info_des' => array('type' => 'text', 'nullable' => True), |
|
102 | + 'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
103 | + 'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
104 | + 'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'), |
|
105 | + 'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
106 | + 'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
107 | + 'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
108 | + 'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
109 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
110 | + 'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'), |
|
111 | + 'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
112 | + 'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
113 | + 'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'), |
|
114 | + 'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not'), |
|
115 | + 'info_event_id' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False) |
|
116 | 116 | ), |
117 | 117 | 'pk' => array('info_id'), |
118 | 118 | 'fk' => array(), |
119 | 119 | 'ix' => array(), |
120 | 120 | 'uc' => array() |
121 | - ),'info_proj_id'); |
|
122 | - $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( |
|
121 | + ), 'info_proj_id'); |
|
122 | + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array( |
|
123 | 123 | 'fd' => array( |
124 | - 'info_id' => array('type' => 'auto','nullable' => False), |
|
125 | - 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), |
|
126 | - 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
127 | - 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
128 | - 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), |
|
129 | - 'info_des' => array('type' => 'text','nullable' => True), |
|
130 | - 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
131 | - 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
132 | - 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), |
|
133 | - 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
134 | - 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), |
|
135 | - 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
136 | - 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
137 | - 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
138 | - 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), |
|
139 | - 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
140 | - 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), |
|
141 | - 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), |
|
142 | - 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not') |
|
124 | + 'info_id' => array('type' => 'auto', 'nullable' => False), |
|
125 | + 'info_type' => array('type' => 'varchar', 'precision' => '255', 'default' => 'task', 'nullable' => False), |
|
126 | + 'info_from' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
127 | + 'info_addr' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
128 | + 'info_subject' => array('type' => 'varchar', 'precision' => '64', 'nullable' => True), |
|
129 | + 'info_des' => array('type' => 'text', 'nullable' => True), |
|
130 | + 'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
131 | + 'info_responsible' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
132 | + 'info_access' => array('type' => 'varchar', 'precision' => '10', 'nullable' => True, 'default' => 'public'), |
|
133 | + 'info_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
134 | + 'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
135 | + 'info_startdate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
136 | + 'info_enddate' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
137 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
138 | + 'info_pri' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'normal'), |
|
139 | + 'info_time' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
140 | + 'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'nullable' => False), |
|
141 | + 'info_status' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'done'), |
|
142 | + 'info_confirm' => array('type' => 'varchar', 'precision' => '255', 'nullable' => True, 'default' => 'not') |
|
143 | 143 | ), |
144 | 144 | 'pk' => array('info_id'), |
145 | 145 | 'fk' => array(), |
146 | 146 | 'ix' => array(), |
147 | 147 | 'uc' => array() |
148 | - ),'info_event_id'); |
|
148 | + ), 'info_event_id'); |
|
149 | 149 | |
150 | 150 | return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.003'; |
151 | 151 | } |
@@ -153,37 +153,37 @@ discard block |
||
153 | 153 | |
154 | 154 | function infolog_upgrade0_9_15_003() |
155 | 155 | { |
156 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array( |
|
156 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_type', array( |
|
157 | 157 | 'type' => 'varchar', |
158 | 158 | 'precision' => '10', |
159 | 159 | 'nullable' => False, |
160 | 160 | 'default' => 'task' |
161 | 161 | )); |
162 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_pri',array( |
|
162 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_pri', array( |
|
163 | 163 | 'type' => 'varchar', |
164 | 164 | 'precision' => '10', |
165 | 165 | 'nullable' => True, |
166 | 166 | 'default' => 'normal' |
167 | 167 | )); |
168 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array( |
|
168 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_status', array( |
|
169 | 169 | 'type' => 'varchar', |
170 | 170 | 'precision' => '10', |
171 | 171 | 'nullable' => True, |
172 | 172 | 'default' => 'done' |
173 | 173 | )); |
174 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_confirm',array( |
|
174 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_confirm', array( |
|
175 | 175 | 'type' => 'varchar', |
176 | 176 | 'precision' => '10', |
177 | 177 | 'nullable' => True, |
178 | 178 | 'default' => 'not' |
179 | 179 | )); |
180 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_modifier',array( |
|
180 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_modifier', array( |
|
181 | 181 | 'type' => 'int', |
182 | 182 | 'precision' => '4', |
183 | 183 | 'nullable' => False, |
184 | 184 | 'default' => '0' |
185 | 185 | )); |
186 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_link_id',array( |
|
186 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_link_id', array( |
|
187 | 187 | 'type' => 'int', |
188 | 188 | 'precision' => '4', |
189 | 189 | 'nullable' => False, |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0); |
199 | 199 | } |
200 | 200 | reset($links); |
201 | - while (list($info_id,$link_id) = each($links)) |
|
201 | + while (list($info_id, $link_id) = each($links)) |
|
202 | 202 | { |
203 | 203 | $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id"); |
204 | 204 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | { |
212 | 212 | // this update correctes wrong escapes of ' and " in the past |
213 | 213 | // |
214 | - $db2 = $GLOBALS['egw_setup']->db; // we need a 2. result-set |
|
214 | + $db2 = $GLOBALS['egw_setup']->db; // we need a 2. result-set |
|
215 | 215 | |
216 | - $to_correct = array('info_from','info_subject','info_des'); |
|
216 | + $to_correct = array('info_from', 'info_subject', 'info_des'); |
|
217 | 217 | foreach ($to_correct as $col) |
218 | 218 | { |
219 | 219 | $GLOBALS['egw_setup']->oProc->query("SELECT info_id,$col FROM phpgw_infolog WHERE $col LIKE '%\\'%' OR $col LIKE '%\"%'"); |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | |
231 | 231 | function infolog_upgrade0_9_15_005() |
232 | 232 | { |
233 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_infolog_extra',array( |
|
233 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_infolog_extra', array( |
|
234 | 234 | 'fd' => array( |
235 | - 'info_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
236 | - 'info_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False), |
|
237 | - 'info_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
235 | + 'info_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
236 | + 'info_extra_name' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False), |
|
237 | + 'info_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
238 | 238 | ), |
239 | - 'pk' => array('info_id','info_extra_name'), |
|
239 | + 'pk' => array('info_id', 'info_extra_name'), |
|
240 | 240 | 'fk' => array(), |
241 | 241 | 'ix' => array(), |
242 | 242 | 'uc' => array() |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | // the following series of updates add some indices, to speedup the selects |
250 | 250 | function infolog_upgrade0_9_15_006() |
251 | 251 | { |
252 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_links',array( |
|
252 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_links', array( |
|
253 | 253 | 'fd' => array( |
254 | - 'link_id' => array('type' => 'auto','nullable' => False), |
|
255 | - 'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False), |
|
256 | - 'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
257 | - 'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False), |
|
258 | - 'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
259 | - 'link_remark' => array('type' => 'varchar','precision' => '50'), |
|
260 | - 'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False), |
|
261 | - 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False) |
|
254 | + 'link_id' => array('type' => 'auto', 'nullable' => False), |
|
255 | + 'link_app1' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False), |
|
256 | + 'link_id1' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
257 | + 'link_app2' => array('type' => 'varchar', 'precision' => '25', 'nullable' => False), |
|
258 | + 'link_id2' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
259 | + 'link_remark' => array('type' => 'varchar', 'precision' => '50'), |
|
260 | + 'link_lastmod' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
261 | + 'link_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False) |
|
262 | 262 | ), |
263 | 263 | 'pk' => array('link_id'), |
264 | 264 | 'fk' => array(), |
265 | - 'ix' => array(array('link_app1','link_id1','link_lastmod'),array('link_app2','link_id2','link_lastmod')), |
|
265 | + 'ix' => array(array('link_app1', 'link_id1', 'link_lastmod'), array('link_app2', 'link_id2', 'link_lastmod')), |
|
266 | 266 | 'uc' => array() |
267 | 267 | )); |
268 | 268 | |
@@ -272,33 +272,33 @@ discard block |
||
272 | 272 | |
273 | 273 | function infolog_upgrade0_9_15_007() |
274 | 274 | { |
275 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_infolog',array( |
|
275 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_infolog', array( |
|
276 | 276 | 'fd' => array( |
277 | - 'info_id' => array('type' => 'auto','nullable' => False), |
|
278 | - 'info_type' => array('type' => 'varchar','precision' => '10','nullable' => False,'default' => 'task'), |
|
279 | - 'info_from' => array('type' => 'varchar','precision' => '64'), |
|
280 | - 'info_addr' => array('type' => 'varchar','precision' => '64'), |
|
281 | - 'info_subject' => array('type' => 'varchar','precision' => '64'), |
|
277 | + 'info_id' => array('type' => 'auto', 'nullable' => False), |
|
278 | + 'info_type' => array('type' => 'varchar', 'precision' => '10', 'nullable' => False, 'default' => 'task'), |
|
279 | + 'info_from' => array('type' => 'varchar', 'precision' => '64'), |
|
280 | + 'info_addr' => array('type' => 'varchar', 'precision' => '64'), |
|
281 | + 'info_subject' => array('type' => 'varchar', 'precision' => '64'), |
|
282 | 282 | 'info_des' => array('type' => 'text'), |
283 | - 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
284 | - 'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
285 | - 'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'), |
|
286 | - 'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
287 | - 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), |
|
288 | - 'info_startdate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
289 | - 'info_enddate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
290 | - 'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
291 | - 'info_pri' => array('type' => 'varchar','precision' => '10','default' => 'normal'), |
|
292 | - 'info_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
293 | - 'info_bill_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
294 | - 'info_status' => array('type' => 'varchar','precision' => '10','default' => 'done'), |
|
295 | - 'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'), |
|
296 | - 'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
297 | - 'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0') |
|
283 | + 'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
284 | + 'info_responsible' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
285 | + 'info_access' => array('type' => 'varchar', 'precision' => '10', 'default' => 'public'), |
|
286 | + 'info_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
287 | + 'info_datemodified' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
288 | + 'info_startdate' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
289 | + 'info_enddate' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
290 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
291 | + 'info_pri' => array('type' => 'varchar', 'precision' => '10', 'default' => 'normal'), |
|
292 | + 'info_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
293 | + 'info_bill_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
294 | + 'info_status' => array('type' => 'varchar', 'precision' => '10', 'default' => 'done'), |
|
295 | + 'info_confirm' => array('type' => 'varchar', 'precision' => '10', 'default' => 'not'), |
|
296 | + 'info_modifier' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
297 | + 'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0') |
|
298 | 298 | ), |
299 | 299 | 'pk' => array('info_id'), |
300 | 300 | 'fk' => array(), |
301 | - 'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')), |
|
301 | + 'ix' => array(array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')), |
|
302 | 302 | 'uc' => array() |
303 | 303 | )); |
304 | 304 | |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | function infolog_upgrade0_9_15_008() |
311 | 311 | { |
312 | 312 | // update the sequenzes for refreshed tables (postgres only) |
313 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_infolog','info_id'); |
|
314 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_links','link_id'); |
|
313 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_infolog', 'info_id'); |
|
314 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_links', 'link_id'); |
|
315 | 315 | |
316 | 316 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.0'; |
317 | 317 | } |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | function infolog_upgrade1_0_0() |
321 | 321 | { |
322 | 322 | // longer columns to cope with multibyte charsets |
323 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array( |
|
323 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_type', array( |
|
324 | 324 | 'type' => 'varchar', |
325 | 325 | 'precision' => '40', |
326 | 326 | 'nullable' => False, |
327 | 327 | 'default' => 'task' |
328 | 328 | )); |
329 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_from',array( |
|
329 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_from', array( |
|
330 | 330 | 'type' => 'varchar', |
331 | 331 | 'precision' => '255' |
332 | 332 | )); |
333 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_addr',array( |
|
333 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_addr', array( |
|
334 | 334 | 'type' => 'varchar', |
335 | 335 | 'precision' => '255' |
336 | 336 | )); |
337 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_subject',array( |
|
337 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_subject', array( |
|
338 | 338 | 'type' => 'varchar', |
339 | 339 | 'precision' => '255' |
340 | 340 | )); |
341 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array( |
|
341 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_status', array( |
|
342 | 342 | 'type' => 'varchar', |
343 | 343 | 'precision' => '40', |
344 | 344 | 'default' => 'done' |
@@ -350,21 +350,21 @@ discard block |
||
350 | 350 | |
351 | 351 | function infolog_upgrade1_0_0_001() |
352 | 352 | { |
353 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_time','info_planned_time'); |
|
354 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_bill_cat','info_used_time'); |
|
353 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_time', 'info_planned_time'); |
|
354 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog', 'info_bill_cat', 'info_used_time'); |
|
355 | 355 | // timestamps have to be 8byte ints |
356 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_datemodified',array( |
|
356 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_datemodified', array( |
|
357 | 357 | 'type' => 'int', |
358 | 358 | 'precision' => '8', |
359 | 359 | 'nullable' => False |
360 | 360 | )); |
361 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_startdate',array( |
|
361 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_startdate', array( |
|
362 | 362 | 'type' => 'int', |
363 | 363 | 'precision' => '8', |
364 | 364 | 'nullable' => False, |
365 | 365 | 'default' => '0' |
366 | 366 | )); |
367 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_enddate',array( |
|
367 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog', 'info_enddate', array( |
|
368 | 368 | 'type' => 'int', |
369 | 369 | 'precision' => '8', |
370 | 370 | 'nullable' => False, |
@@ -372,49 +372,49 @@ discard block |
||
372 | 372 | )); |
373 | 373 | |
374 | 374 | // setting numerical priority 3=urgent, 2=high, 1=normal, 0= |
375 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_priority',array( |
|
375 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog', 'info_priority', array( |
|
376 | 376 | 'type' => 'int', |
377 | 377 | 'precision' => '2', |
378 | 378 | 'default' => '1' |
379 | 379 | )); |
380 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_priority=(CASE WHEN info_pri='urgent' THEN 3 WHEN info_pri='high' THEN 2 WHEN info_pri='low' THEN 0 ELSE 1 END)",__LINE__,__FILE__); |
|
380 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_priority=(CASE WHEN info_pri='urgent' THEN 3 WHEN info_pri='high' THEN 2 WHEN info_pri='low' THEN 0 ELSE 1 END)", __LINE__, __FILE__); |
|
381 | 381 | |
382 | - $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( |
|
382 | + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog', array( |
|
383 | 383 | 'fd' => array( |
384 | - 'info_id' => array('type' => 'auto','nullable' => False), |
|
385 | - 'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task'), |
|
386 | - 'info_from' => array('type' => 'varchar','precision' => '255'), |
|
387 | - 'info_addr' => array('type' => 'varchar','precision' => '255'), |
|
388 | - 'info_subject' => array('type' => 'varchar','precision' => '255'), |
|
384 | + 'info_id' => array('type' => 'auto', 'nullable' => False), |
|
385 | + 'info_type' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False, 'default' => 'task'), |
|
386 | + 'info_from' => array('type' => 'varchar', 'precision' => '255'), |
|
387 | + 'info_addr' => array('type' => 'varchar', 'precision' => '255'), |
|
388 | + 'info_subject' => array('type' => 'varchar', 'precision' => '255'), |
|
389 | 389 | 'info_des' => array('type' => 'text'), |
390 | - 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
391 | - 'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
392 | - 'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'), |
|
393 | - 'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
394 | - 'info_datemodified' => array('type' => 'int','precision' => '8','nullable' => False), |
|
395 | - 'info_startdate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
396 | - 'info_enddate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
397 | - 'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
398 | - 'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
399 | - 'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
400 | - 'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done'), |
|
401 | - 'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'), |
|
402 | - 'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
403 | - 'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
404 | - 'info_priority' => array('type' => 'int','precision' => '2','default' => '1') |
|
390 | + 'info_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
391 | + 'info_responsible' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
392 | + 'info_access' => array('type' => 'varchar', 'precision' => '10', 'default' => 'public'), |
|
393 | + 'info_cat' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
394 | + 'info_datemodified' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
395 | + 'info_startdate' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
396 | + 'info_enddate' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
397 | + 'info_id_parent' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
398 | + 'info_planned_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
399 | + 'info_used_time' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
400 | + 'info_status' => array('type' => 'varchar', 'precision' => '40', 'default' => 'done'), |
|
401 | + 'info_confirm' => array('type' => 'varchar', 'precision' => '10', 'default' => 'not'), |
|
402 | + 'info_modifier' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
403 | + 'info_link_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
404 | + 'info_priority' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
405 | 405 | ), |
406 | 406 | 'pk' => array('info_id'), |
407 | 407 | 'fk' => array(), |
408 | - 'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')), |
|
408 | + 'ix' => array(array('info_owner', 'info_responsible', 'info_status', 'info_startdate'), array('info_id_parent', 'info_owner', 'info_responsible', 'info_status', 'info_startdate')), |
|
409 | 409 | 'uc' => array() |
410 | - ),'info_pri'); |
|
410 | + ), 'info_pri'); |
|
411 | 411 | |
412 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog','egw_infolog'); |
|
413 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog_extra','egw_infolog_extra'); |
|
412 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog', 'egw_infolog'); |
|
413 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog_extra', 'egw_infolog_extra'); |
|
414 | 414 | // only rename links table, if it has not been moved into the API and therefor been already renamed by the API update |
415 | 415 | if ($GLOBALS['egw_setup']->oProc->GetTableDefinition('phpgw_links')) |
416 | 416 | { |
417 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_links','egw_links'); |
|
417 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_links', 'egw_links'); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.001'; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | function infolog_upgrade1_0_1_001() |
425 | 425 | { |
426 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array( |
|
426 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_responsible', array( |
|
427 | 427 | 'type' => 'varchar', |
428 | 428 | 'precision' => '255', |
429 | 429 | 'nullable' => False, |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | |
443 | 443 | function infolog_upgrade1_2() |
444 | 444 | { |
445 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','pl_id',array( |
|
445 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'pl_id', array( |
|
446 | 446 | 'type' => 'int', |
447 | 447 | 'precision' => '4' |
448 | 448 | )); |
449 | 449 | |
450 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_price',array( |
|
450 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_price', array( |
|
451 | 451 | 'type' => 'float', |
452 | 452 | 'precision' => '8' |
453 | 453 | )); |
@@ -458,38 +458,38 @@ discard block |
||
458 | 458 | |
459 | 459 | function infolog_upgrade1_2_001() |
460 | 460 | { |
461 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_percent',array( |
|
461 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_percent', array( |
|
462 | 462 | 'type' => 'int', |
463 | 463 | 'precision' => '2', |
464 | 464 | 'default' => '0' |
465 | 465 | )); |
466 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_datecompleted',array( |
|
466 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_datecompleted', array( |
|
467 | 467 | 'type' => 'int', |
468 | 468 | 'precision' => '8' |
469 | 469 | )); |
470 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_location',array( |
|
470 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_location', array( |
|
471 | 471 | 'type' => 'varchar', |
472 | 472 | 'precision' => '255' |
473 | 473 | )); |
474 | 474 | |
475 | 475 | // all not explicit named stati have the default percent 0 |
476 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=10 WHERE info_status='ongoing'",__LINE__,__FILE__); |
|
477 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=50 WHERE info_status='will-call'",__LINE__,__FILE__); |
|
476 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=10 WHERE info_status='ongoing'", __LINE__, __FILE__); |
|
477 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=50 WHERE info_status='will-call'", __LINE__, __FILE__); |
|
478 | 478 | |
479 | - for($p = 0; $p <= 90; $p += 10) |
|
479 | + for ($p = 0; $p <= 90; $p += 10) |
|
480 | 480 | { |
481 | 481 | $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=$p,info_status='".(!$p ? 'not-started' : 'ongoing'). |
482 | - "' WHERE info_status = '$p%'",__LINE__,__FILE__); |
|
482 | + "' WHERE info_status = '$p%'", __LINE__, __FILE__); |
|
483 | 483 | } |
484 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_datecompleted=info_datemodified,info_percent=100 WHERE info_status IN ('done','billed','100%')",__LINE__,__FILE__); |
|
484 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_datecompleted=info_datemodified,info_percent=100 WHERE info_status IN ('done','billed','100%')", __LINE__, __FILE__); |
|
485 | 485 | |
486 | 486 | // remove the percentages from the custom stati, if they exist |
487 | - $config =& CreateObject('phpgwapi.config','infolog'); |
|
487 | + $config = & CreateObject('phpgwapi.config', 'infolog'); |
|
488 | 488 | $config->read_repository(); |
489 | 489 | if (is_array($config->config_data['status']['task'])) |
490 | 490 | { |
491 | 491 | $config->config_data['status']['task'] = array_diff($config->config_data['status']['task'], |
492 | - array('0%','10%','20%','30%','40%','50%','60%','70%','80%','90%','100%')); |
|
492 | + array('0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%')); |
|
493 | 493 | $config->save_repository(); |
494 | 494 | } |
495 | 495 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.002'; |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | function infolog_upgrade1_2_002() |
500 | 500 | { |
501 | 501 | // change the phone-status: call --> not-started, will-call --> ongoing to be able to sync them |
502 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='not-started' WHERE info_status='call'",__LINE__,__FILE__); |
|
503 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='ongoing' WHERE info_status='will-call'",__LINE__,__FILE__); |
|
502 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='not-started' WHERE info_status='call'", __LINE__, __FILE__); |
|
503 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='ongoing' WHERE info_status='will-call'", __LINE__, __FILE__); |
|
504 | 504 | |
505 | 505 | // remove the call and will-call from the custom stati, if they exist |
506 | - $config =& CreateObject('phpgwapi.config','infolog'); |
|
506 | + $config = & CreateObject('phpgwapi.config', 'infolog'); |
|
507 | 507 | $config->read_repository(); |
508 | 508 | if (is_array($config->config_data['status']['phone'])) |
509 | 509 | { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | function infolog_upgrade1_2_003() |
520 | 520 | { |
521 | 521 | // fix wrong info_responsible='' --> '0' |
522 | - $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_responsible='0' WHERE info_responsible=''",__LINE__,__FILE__); |
|
522 | + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_responsible='0' WHERE info_responsible=''", __LINE__, __FILE__); |
|
523 | 523 | |
524 | 524 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.004'; |
525 | 525 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | function infolog_upgrade1_2_004() |
529 | 529 | { |
530 | 530 | // column to save if from contains a custom text |
531 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_custom_from',array( |
|
531 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_custom_from', array( |
|
532 | 532 | 'type' => 'int', |
533 | 533 | 'precision' => '1', |
534 | 534 | )); |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | |
546 | 546 | function infolog_upgrade1_4() |
547 | 547 | { |
548 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_uid',array( |
|
548 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_uid', array( |
|
549 | 549 | 'type' => 'varchar', |
550 | 550 | 'precision' => '255' |
551 | 551 | )); |
552 | - $GLOBALS['egw_setup']->db->query("SELECT config_value FROM egw_config WHERE config_app='phpgwapi' AND config_name='install_id'",__LINE__,__FILE__); |
|
552 | + $GLOBALS['egw_setup']->db->query("SELECT config_value FROM egw_config WHERE config_app='phpgwapi' AND config_name='install_id'", __LINE__, __FILE__); |
|
553 | 553 | $install_id = $GLOBALS['egw_setup']->db->next_record() ? $GLOBALS['egw_setup']->db->f(0) : md5(time()); |
554 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET info_uid='.$GLOBALS['egw_setup']->db->concat("'infolog-'",'info_id',"'-$install_id'"),__LINE__,__FILE__); |
|
554 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET info_uid='.$GLOBALS['egw_setup']->db->concat("'infolog-'", 'info_id', "'-$install_id'"), __LINE__, __FILE__); |
|
555 | 555 | |
556 | 556 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.001'; |
557 | 557 | } |
@@ -564,17 +564,17 @@ discard block |
||
564 | 564 | */ |
565 | 565 | function infolog_upgrade1_5_001() |
566 | 566 | { |
567 | - foreach($GLOBALS['egw_setup']->db->select('egw_infolog','info_id,info_link_id,org_name,adr_one_locality,n_family,n_given',array( |
|
567 | + foreach ($GLOBALS['egw_setup']->db->select('egw_infolog', 'info_id,info_link_id,org_name,adr_one_locality,n_family,n_given', array( |
|
568 | 568 | 'info_from' => '', |
569 | 569 | 'info_link_id > 0', |
570 | - ),__LINE__,__FILE__,false,'','infolog',0, |
|
570 | + ), __LINE__, __FILE__, false, '', 'infolog', 0, |
|
571 | 571 | " JOIN egw_links ON info_link_id=link_id AND link_app2='addressbook'". |
572 | 572 | " JOIN egw_addressbook ON contact_id=link_id2") as $row) |
573 | 573 | { |
574 | 574 | $from = ($row['org_name'] ? $row['org_name'].', '.$row['adr_one_locality'].': ' : ''). |
575 | 575 | $row['n_family'].($row['n_given'] ? ', '.$row['n_given'] : ''); |
576 | - $GLOBALS['egw_setup']->db->update('egw_infolog',array('info_from' => $from), |
|
577 | - array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog'); |
|
576 | + $GLOBALS['egw_setup']->db->update('egw_infolog', array('info_from' => $from), |
|
577 | + array('info_id' => $row['info_id']), __LINE__, __FILE__, 'infolog'); |
|
578 | 578 | } |
579 | 579 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.002'; |
580 | 580 | } |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | */ |
588 | 588 | function infolog_upgrade1_5_002() |
589 | 589 | { |
590 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_name',array( |
|
590 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_name', array( |
|
591 | 591 | 'type' => 'varchar', |
592 | 592 | 'precision' => '64', |
593 | 593 | 'nullable' => False |
594 | 594 | )); |
595 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_value',array( |
|
595 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_value', array( |
|
596 | 596 | 'type' => 'text', |
597 | 597 | 'nullable' => False |
598 | 598 | )); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | function infolog_upgrade1_5_003() |
610 | 610 | { |
611 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_replanned_time',array( |
|
611 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_replanned_time', array( |
|
612 | 612 | 'type' => 'int', |
613 | 613 | 'precision' => '4', |
614 | 614 | 'nullable' => False, |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | |
638 | 638 | function infolog_upgrade1_8() |
639 | 639 | { |
640 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_cc',array( |
|
640 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_cc', array( |
|
641 | 641 | 'type' => 'varchar', |
642 | 642 | 'precision' => '255' |
643 | 643 | )); |
@@ -651,29 +651,29 @@ discard block |
||
651 | 651 | */ |
652 | 652 | function infolog_upgrade1_9_001() |
653 | 653 | { |
654 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','caldav_name',array( |
|
654 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'caldav_name', array( |
|
655 | 655 | 'type' => 'varchar', |
656 | 656 | 'precision' => '64', |
657 | 657 | 'comment' => 'name part of CalDAV URL, if specified by client' |
658 | 658 | )); |
659 | 659 | $GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET caldav_name='. |
660 | 660 | $GLOBALS['egw_setup']->db->concat( |
661 | - $GLOBALS['egw_setup']->db->to_varchar('info_id'),"'.ics'"),__LINE__,__FILE__); |
|
661 | + $GLOBALS['egw_setup']->db->to_varchar('info_id'), "'.ics'"), __LINE__, __FILE__); |
|
662 | 662 | |
663 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog','caldav_name'); |
|
663 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_infolog', 'caldav_name'); |
|
664 | 664 | |
665 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_etag',array( |
|
665 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_etag', array( |
|
666 | 666 | 'type' => 'int', |
667 | 667 | 'precision' => '4', |
668 | 668 | 'default' => '0', |
669 | 669 | 'comment' => 'etag, not yet used' |
670 | 670 | )); |
671 | 671 | |
672 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_created',array( |
|
672 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_created', array( |
|
673 | 673 | 'type' => 'int', |
674 | 674 | 'precision' => '8', |
675 | 675 | )); |
676 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_creator',array( |
|
676 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog', 'info_creator', array( |
|
677 | 677 | 'type' => 'int', |
678 | 678 | 'precision' => '4', |
679 | 679 | )); |
@@ -688,18 +688,18 @@ discard block |
||
688 | 688 | function infolog_upgrade1_9_002() |
689 | 689 | { |
690 | 690 | $ids = array(); |
691 | - foreach($GLOBALS['egw_setup']->db->query('SELECT sub.info_id |
|
691 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT sub.info_id |
|
692 | 692 | FROM egw_infolog sub |
693 | 693 | JOIN egw_infolog parent ON sub.info_id_parent=parent.info_id |
694 | -WHERE parent.caldav_name=sub.caldav_name',__LINE__,__FILE__) as $row) |
|
694 | +WHERE parent.caldav_name=sub.caldav_name',__LINE__, __FILE__) as $row) |
|
695 | 695 | { |
696 | 696 | $ids[] = $row['info_id']; |
697 | 697 | } |
698 | 698 | if ($ids) |
699 | 699 | { |
700 | 700 | $GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET caldav_name='. |
701 | - $GLOBALS['egw_setup']->db->concat('info_id',"'.ics'"). |
|
702 | - ' WHERE info_id IN ('.implode(',',$ids).')',__LINE__,__FILE__); |
|
701 | + $GLOBALS['egw_setup']->db->concat('info_id', "'.ics'"). |
|
702 | + ' WHERE info_id IN ('.implode(',', $ids).')', __LINE__, __FILE__); |
|
703 | 703 | } |
704 | 704 | return $GLOBALS['setup_info']['infolog']['currentver'] = '1.9.003'; |
705 | 705 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | function infolog_upgrade1_9_003() |
709 | 709 | { |
710 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','caldav_name',array( |
|
710 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'caldav_name', array( |
|
711 | 711 | 'type' => 'varchar', |
712 | 712 | 'precision' => '200', |
713 | 713 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | } |
753 | 753 | function infolog_upgrade14_2() |
754 | 754 | { |
755 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array( |
|
755 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_responsible', array( |
|
756 | 756 | 'type' => 'ascii', |
757 | 757 | 'meta' => 'account-commasep', |
758 | 758 | 'precision' => '255', |
@@ -760,23 +760,23 @@ discard block |
||
760 | 760 | 'default' => '0', |
761 | 761 | 'comment' => 'responsible users or groups (multiple)' |
762 | 762 | )); |
763 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_access',array( |
|
763 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_access', array( |
|
764 | 764 | 'type' => 'ascii', |
765 | 765 | 'precision' => '10', |
766 | 766 | 'default' => 'public', |
767 | 767 | 'comment' => 'public or privat' |
768 | 768 | )); |
769 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_confirm',array( |
|
769 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_confirm', array( |
|
770 | 770 | 'type' => 'ascii', |
771 | 771 | 'precision' => '10', |
772 | 772 | 'default' => 'not' |
773 | 773 | )); |
774 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_uid',array( |
|
774 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'info_uid', array( |
|
775 | 775 | 'type' => 'ascii', |
776 | 776 | 'precision' => '128', |
777 | 777 | 'comment' => 'unique id of the infolog-entry' |
778 | 778 | )); |
779 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','caldav_name',array( |
|
779 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog', 'caldav_name', array( |
|
780 | 780 | 'type' => 'ascii', |
781 | 781 | 'precision' => '128', |
782 | 782 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | |
789 | 789 | function infolog_upgrade14_2_001() |
790 | 790 | { |
791 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_value',array( |
|
791 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra', 'info_extra_value', array( |
|
792 | 792 | 'type' => 'varchar', |
793 | 793 | 'meta' => 'cfvalue', |
794 | 794 | 'precision' => '16384', |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | * import ical for infolog |
16 | 16 | * Not a lot of options for this, just uses the ical class |
17 | 17 | */ |
18 | -class infolog_import_ical implements importexport_iface_import_plugin { |
|
18 | +class infolog_import_ical implements importexport_iface_import_plugin { |
|
19 | 19 | |
20 | 20 | private static $plugin_options = array( |
21 | - 'conditions', /* => array containing condition arrays: |
|
21 | + 'conditions', /* => array containing condition arrays: |
|
22 | 22 | 'type' => exists, // exists |
23 | 23 | 'string' => '#kundennummer', |
24 | 24 | 'true' => array( |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | * @param string $_charset |
80 | 80 | * @param definition $_definition |
81 | 81 | */ |
82 | - public function import( $_stream, importexport_definition $_definition ) { |
|
82 | + public function import($_stream, importexport_definition $_definition) { |
|
83 | 83 | |
84 | 84 | $this->definition = $_definition; |
85 | 85 | |
86 | 86 | // dry run? |
87 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
87 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
88 | 88 | |
89 | 89 | $success = 0; |
90 | 90 | |
91 | 91 | // Failures |
92 | 92 | $this->errors = array(); |
93 | 93 | |
94 | - @set_time_limit(0); // try switching execution time limit off |
|
94 | + @set_time_limit(0); // try switching execution time limit off |
|
95 | 95 | |
96 | 96 | $infolog_ical = new infolog_ical(); |
97 | 97 | if (!$infolog_ical->importVTODO(stream_get_contents($_stream))) |
@@ -104,8 +104,7 @@ |
||
104 | 104 | /** |
105 | 105 | * imports entries according to given definition object. |
106 | 106 | * @param resource $_stream |
107 | - * @param string $_charset |
|
108 | - * @param definition $_definition |
|
107 | + * @param importexport_definition $_definition |
|
109 | 108 | */ |
110 | 109 | public function import( $_stream, importexport_definition $_definition ) { |
111 | 110 | $import_csv = new importexport_import_csv( $_stream, array( |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | protected $errors = array(); |
72 | 72 | |
73 | 73 | /** |
74 | - * List of actions, and how many times that action was taken |
|
75 | - */ |
|
76 | - protected $results = array(); |
|
74 | + * List of actions, and how many times that action was taken |
|
75 | + */ |
|
76 | + protected $results = array(); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * imports entries according to given definition object. |
@@ -163,39 +163,39 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | - * Returns warnings that were encountered during importing |
|
167 | - * Maximum of one warning message per record, but you can append if you need to |
|
168 | - * |
|
169 | - * @return Array ( |
|
170 | - * record_# => warning message |
|
171 | - * ) |
|
172 | - */ |
|
173 | - public function get_warnings() { |
|
166 | + * Returns warnings that were encountered during importing |
|
167 | + * Maximum of one warning message per record, but you can append if you need to |
|
168 | + * |
|
169 | + * @return Array ( |
|
170 | + * record_# => warning message |
|
171 | + * ) |
|
172 | + */ |
|
173 | + public function get_warnings() { |
|
174 | 174 | return $this->warnings; |
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Returns errors that were encountered during importing |
|
179 | - * Maximum of one error message per record, but you can append if you need to |
|
180 | - * |
|
181 | - * @return Array ( |
|
182 | - * record_# => error message |
|
183 | - * ) |
|
184 | - */ |
|
185 | - public function get_errors() { |
|
178 | + * Returns errors that were encountered during importing |
|
179 | + * Maximum of one error message per record, but you can append if you need to |
|
180 | + * |
|
181 | + * @return Array ( |
|
182 | + * record_# => error message |
|
183 | + * ) |
|
184 | + */ |
|
185 | + public function get_errors() { |
|
186 | 186 | return $this->errors; |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * Returns a list of actions taken, and the number of records for that action. |
|
191 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
192 | - * |
|
193 | - * @return Array ( |
|
194 | - * action => record count |
|
195 | - * ) |
|
196 | - */ |
|
197 | - public function get_results() { |
|
198 | - return $this->results; |
|
199 | - } |
|
190 | + * Returns a list of actions taken, and the number of records for that action. |
|
191 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
192 | + * |
|
193 | + * @return Array ( |
|
194 | + * action => record count |
|
195 | + * ) |
|
196 | + */ |
|
197 | + public function get_results() { |
|
198 | + return $this->results; |
|
199 | + } |
|
200 | 200 | } // end of iface_export_plugin |
201 | 201 | ?> |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | * import ical for infolog |
17 | 17 | * Not a lot of options for this, just uses the ical class |
18 | 18 | */ |
19 | -class infolog_import_ical implements importexport_iface_import_plugin { |
|
19 | +class infolog_import_ical implements importexport_iface_import_plugin |
|
20 | +{ |
|
20 | 21 | |
21 | 22 | private static $plugin_options = array( |
22 | 23 | 'conditions', /* => array containing condition arrays: |
@@ -81,7 +82,8 @@ discard block |
||
81 | 82 | * @param string $_charset |
82 | 83 | * @param definition $_definition |
83 | 84 | */ |
84 | - public function import( $_stream, importexport_definition $_definition ) { |
|
85 | + public function import( $_stream, importexport_definition $_definition ) |
|
86 | + { |
|
85 | 87 | |
86 | 88 | $this->definition = $_definition; |
87 | 89 | |
@@ -115,7 +117,8 @@ discard block |
||
115 | 117 | * |
116 | 118 | * @return string name |
117 | 119 | */ |
118 | - public static function get_name() { |
|
120 | + public static function get_name() |
|
121 | + { |
|
119 | 122 | return lang('Infolog iCal import'); |
120 | 123 | } |
121 | 124 | |
@@ -124,7 +127,8 @@ discard block |
||
124 | 127 | * |
125 | 128 | * @return string descriprion |
126 | 129 | */ |
127 | - public static function get_description() { |
|
130 | + public static function get_description() |
|
131 | + { |
|
128 | 132 | return lang("Imports TODOs into Infolog from an iCal File."); |
129 | 133 | } |
130 | 134 | |
@@ -133,7 +137,8 @@ discard block |
||
133 | 137 | * |
134 | 138 | * @return string suffix (comma seperated) |
135 | 139 | */ |
136 | - public static function get_filesuffix() { |
|
140 | + public static function get_filesuffix() |
|
141 | + { |
|
137 | 142 | return 'ics'; |
138 | 143 | } |
139 | 144 | |
@@ -149,7 +154,8 @@ discard block |
||
149 | 154 | * preserv => array, |
150 | 155 | * ) |
151 | 156 | */ |
152 | - public function get_options_etpl() { |
|
157 | + public function get_options_etpl() |
|
158 | + { |
|
153 | 159 | // lets do it! |
154 | 160 | } |
155 | 161 | |
@@ -158,7 +164,8 @@ discard block |
||
158 | 164 | * |
159 | 165 | * @return string etemplate name |
160 | 166 | */ |
161 | - public function get_selectors_etpl() { |
|
167 | + public function get_selectors_etpl() |
|
168 | + { |
|
162 | 169 | // lets do it! |
163 | 170 | } |
164 | 171 | |
@@ -170,7 +177,8 @@ discard block |
||
170 | 177 | * record_# => warning message |
171 | 178 | * ) |
172 | 179 | */ |
173 | - public function get_warnings() { |
|
180 | + public function get_warnings() |
|
181 | + { |
|
174 | 182 | return $this->warnings; |
175 | 183 | } |
176 | 184 | |
@@ -182,7 +190,8 @@ discard block |
||
182 | 190 | * record_# => error message |
183 | 191 | * ) |
184 | 192 | */ |
185 | - public function get_errors() { |
|
193 | + public function get_errors() |
|
194 | + { |
|
186 | 195 | return $this->errors; |
187 | 196 | } |
188 | 197 | |
@@ -194,7 +203,8 @@ discard block |
||
194 | 203 | * action => record count |
195 | 204 | * ) |
196 | 205 | */ |
197 | - public function get_results() { |
|
206 | + public function get_results() |
|
207 | + { |
|
198 | 208 | return $this->results; |
199 | 209 | } |
200 | 210 | } // end of iface_export_plugin |
@@ -25,11 +25,11 @@ |
||
25 | 25 | // Used in conversions |
26 | 26 | static $types = array( |
27 | 27 | 'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'), |
28 | - 'select-cat' => array('info_cat'), |
|
29 | - 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | - 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
28 | + 'select-cat' => array('info_cat'), |
|
29 | + 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | + 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
31 | 31 | 'links' => array('info_link_id'), |
32 | - ); |
|
32 | + ); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * constructor |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | static $types = array( |
27 | 27 | 'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'), |
28 | 28 | 'select-cat' => array('info_cat'), |
29 | - 'select-account' => array('info_owner','info_responsible','info_modifier'), |
|
30 | - 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), |
|
29 | + 'select-account' => array('info_owner', 'info_responsible', 'info_modifier'), |
|
30 | + 'date-time' => array('info_startdate', 'info_enddate', 'info_datecompleted', 'info_datemodified', 'info_created'), |
|
31 | 31 | 'links' => array('info_link_id'), |
32 | 32 | ); |
33 | 33 | |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct($_identifier = '') { |
|
41 | 41 | $this->identifier = $_identifier; |
42 | - if(self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | - if($_identifier) { |
|
42 | + if (self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | + if ($_identifier) { |
|
44 | 44 | $rec = self::$bo->read($this->identifier); |
45 | 45 | if (is_array($rec)) $this->set_record($rec); |
46 | 46 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @todo add some checks |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - public function set_record(array $_record){ |
|
98 | + public function set_record(array $_record) { |
|
99 | 99 | $this->record = $_record; |
100 | 100 | } |
101 | 101 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string identifier |
135 | 135 | */ |
136 | - public function save ( $_dst_identifier ) { |
|
136 | + public function save($_dst_identifier) { |
|
137 | 137 | |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $_dst_identifier |
144 | 144 | * @return string dst_identifier |
145 | 145 | */ |
146 | - public function copy ( $_dst_identifier ) { |
|
146 | + public function copy($_dst_identifier) { |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string $_dst_identifier |
155 | 155 | * @return string dst_identifier |
156 | 156 | */ |
157 | - public function move ( $_dst_identifier ) { |
|
157 | + public function move($_dst_identifier) { |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * delets current record from backend |
163 | 163 | * |
164 | 164 | */ |
165 | - public function delete () { |
|
165 | + public function delete() { |
|
166 | 166 | |
167 | 167 | } |
168 | 168 |
@@ -37,12 +37,20 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct( $_identifier='' ) |
|
41 | + { |
|
41 | 42 | $this->identifier = $_identifier; |
42 | - if(self::$bo == null) self::$bo = new infolog_bo(); |
|
43 | - if($_identifier) { |
|
43 | + if(self::$bo == null) |
|
44 | + { |
|
45 | + self::$bo = new infolog_bo(); |
|
46 | + } |
|
47 | + if($_identifier) |
|
48 | + { |
|
44 | 49 | $rec = self::$bo->read($this->identifier); |
45 | - if (is_array($rec)) $this->set_record($rec); |
|
50 | + if (is_array($rec)) |
|
51 | + { |
|
52 | + $this->set_record($rec); |
|
53 | + } |
|
46 | 54 | } |
47 | 55 | } |
48 | 56 | |
@@ -51,7 +59,8 @@ discard block |
||
51 | 59 | * |
52 | 60 | * @param string $_attribute_name |
53 | 61 | */ |
54 | - public function __get($_attribute_name) { |
|
62 | + public function __get($_attribute_name) |
|
63 | + { |
|
55 | 64 | return $this->record[$_attribute_name]; |
56 | 65 | } |
57 | 66 | |
@@ -61,7 +70,8 @@ discard block |
||
61 | 70 | * @param string $_attribute_name |
62 | 71 | * @param data $data |
63 | 72 | */ |
64 | - public function __set($_attribute_name, $data) { |
|
73 | + public function __set($_attribute_name, $data) |
|
74 | + { |
|
65 | 75 | $this->record[$_attribute_name] = $data; |
66 | 76 | } |
67 | 77 | |
@@ -73,7 +83,8 @@ discard block |
||
73 | 83 | * |
74 | 84 | * @return array complete record as associative array |
75 | 85 | */ |
76 | - public function get_record_array() { |
|
86 | + public function get_record_array() |
|
87 | + { |
|
77 | 88 | return $this->record; |
78 | 89 | } |
79 | 90 | |
@@ -82,8 +93,10 @@ discard block |
||
82 | 93 | * |
83 | 94 | *@return string tiltle |
84 | 95 | */ |
85 | - public function get_title() { |
|
86 | - if (empty($this->record)) { |
|
96 | + public function get_title() |
|
97 | + { |
|
98 | + if (empty($this->record)) |
|
99 | + { |
|
87 | 100 | $this->get_record(); |
88 | 101 | } |
89 | 102 | return self::$bo->link_title($this->record); |
@@ -95,7 +108,8 @@ discard block |
||
95 | 108 | * @todo add some checks |
96 | 109 | * @return void |
97 | 110 | */ |
98 | - public function set_record(array $_record){ |
|
111 | + public function set_record(array $_record) |
|
112 | + { |
|
99 | 113 | $this->record = $_record; |
100 | 114 | } |
101 | 115 | |
@@ -104,7 +118,8 @@ discard block |
||
104 | 118 | * |
105 | 119 | * @return string identifier of current record |
106 | 120 | */ |
107 | - public function get_identifier() { |
|
121 | + public function get_identifier() |
|
122 | + { |
|
108 | 123 | return $this->identifier; |
109 | 124 | } |
110 | 125 | |
@@ -114,7 +129,8 @@ discard block |
||
114 | 129 | * |
115 | 130 | * @return string Full URL of an icon, or appname/icon_name |
116 | 131 | */ |
117 | - public function get_icon() { |
|
132 | + public function get_icon() |
|
133 | + { |
|
118 | 134 | $icon = 'infolog/navbar'; |
119 | 135 | $ui = new infolog_ui(); |
120 | 136 | if (!($icon = $ui->icons['type'][$this->info_type])) |
@@ -133,7 +149,8 @@ discard block |
||
133 | 149 | * |
134 | 150 | * @return string identifier |
135 | 151 | */ |
136 | - public function save ( $_dst_identifier ) { |
|
152 | + public function save ( $_dst_identifier ) |
|
153 | + { |
|
137 | 154 | |
138 | 155 | } |
139 | 156 | |
@@ -143,7 +160,8 @@ discard block |
||
143 | 160 | * @param string $_dst_identifier |
144 | 161 | * @return string dst_identifier |
145 | 162 | */ |
146 | - public function copy ( $_dst_identifier ) { |
|
163 | + public function copy ( $_dst_identifier ) |
|
164 | + { |
|
147 | 165 | |
148 | 166 | } |
149 | 167 | |
@@ -154,7 +172,8 @@ discard block |
||
154 | 172 | * @param string $_dst_identifier |
155 | 173 | * @return string dst_identifier |
156 | 174 | */ |
157 | - public function move ( $_dst_identifier ) { |
|
175 | + public function move ( $_dst_identifier ) |
|
176 | + { |
|
158 | 177 | |
159 | 178 | } |
160 | 179 | |
@@ -162,7 +181,8 @@ discard block |
||
162 | 181 | * delets current record from backend |
163 | 182 | * |
164 | 183 | */ |
165 | - public function delete () { |
|
184 | + public function delete () |
|
185 | + { |
|
166 | 186 | |
167 | 187 | } |
168 | 188 | |
@@ -170,7 +190,8 @@ discard block |
||
170 | 190 | * destructor |
171 | 191 | * |
172 | 192 | */ |
173 | - public function __destruct() { |
|
193 | + public function __destruct() |
|
194 | + { |
|
174 | 195 | } |
175 | 196 | |
176 | 197 | } // end of egw_addressbook_record |
@@ -259,10 +259,10 @@ |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
262 | - * Convert some internal data to something with more meaning |
|
263 | - * |
|
264 | - * This is for something specific to Infolog, in addition to the normal conversions. |
|
265 | - */ |
|
262 | + * Convert some internal data to something with more meaning |
|
263 | + * |
|
264 | + * This is for something specific to Infolog, in addition to the normal conversions. |
|
265 | + */ |
|
266 | 266 | public static function convert(infolog_egw_record &$record) { |
267 | 267 | // Stub, for now |
268 | 268 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -247,7 +247,7 @@ |
||
247 | 247 | $this->selects['info_status'] = $this->bo->get_status(); |
248 | 248 | } |
249 | 249 | |
250 | - public function get_filter_fields(Array &$filters) |
|
250 | + public function get_filter_fields(array &$filters) |
|
251 | 251 | { |
252 | 252 | foreach($filters as $field_name => &$settings) |
253 | 253 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param egw_record $_definition |
30 | 30 | */ |
31 | - public function export( $_stream, importexport_definition $_definition) { |
|
31 | + public function export($_stream, importexport_definition $_definition) { |
|
32 | 32 | $options = $_definition->plugin_options; |
33 | 33 | |
34 | 34 | $selection = array(); |
@@ -39,45 +39,45 @@ discard block |
||
39 | 39 | $this->export_object->set_mapping($options['mapping']); |
40 | 40 | |
41 | 41 | $ids = array(); |
42 | - switch($options['selection']) |
|
42 | + switch ($options['selection']) |
|
43 | 43 | { |
44 | 44 | case 'search': |
45 | - $query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data','infolog'), $query); |
|
45 | + $query = array_merge((array)$GLOBALS['egw']->session->appsession('session_data', 'infolog'), $query); |
|
46 | 46 | // Fall through |
47 | 47 | case 'filter': |
48 | 48 | case 'all': |
49 | 49 | // do we need to query the cf's |
50 | 50 | $query['custom_fields'] = false; |
51 | - foreach($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
52 | - if($field[0] == '#') { |
|
51 | + foreach ($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
52 | + if ($field[0] == '#') { |
|
53 | 53 | $query['custom_fields'] = true; |
54 | 54 | $query['selectcols'] .= ",$field"; |
55 | 55 | |
56 | - if($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field,1)]['type']]) |
|
56 | + if ($GLOBALS['egw_info']['user']['apps'][$this->bo->customfields[substr($field, 1)]['type']]) |
|
57 | 57 | { |
58 | - $cf_links[$field] = $this->bo->customfields[substr($field,1)]['type']; |
|
58 | + $cf_links[$field] = $this->bo->customfields[substr($field, 1)]['type']; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
62 | - if($options['selection'] == 'filter') |
|
62 | + if ($options['selection'] == 'filter') |
|
63 | 63 | { |
64 | 64 | $fields = importexport_helper_functions::get_filter_fields($_definition->application, $this); |
65 | 65 | $query['col_filter'] = $_definition->filter; |
66 | 66 | |
67 | 67 | // Backend expects a string |
68 | - if($query['col_filter']['info_responsible']) |
|
68 | + if ($query['col_filter']['info_responsible']) |
|
69 | 69 | { |
70 | - $query['col_filter']['info_responsible'] = implode(',',$query['col_filter']['info_responsible']); |
|
70 | + $query['col_filter']['info_responsible'] = implode(',', $query['col_filter']['info_responsible']); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Handle ranges |
74 | - foreach($query['col_filter'] as $field => $value) |
|
74 | + foreach ($query['col_filter'] as $field => $value) |
|
75 | 75 | { |
76 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
76 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
77 | 77 | |
78 | 78 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
79 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
80 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
79 | + if ($value['from']) $query['col_filter'][] = "$field >= ".(int)$value['from']; |
|
80 | + if ($value['to']) $query['col_filter'][] = "$field <= ".(int)$value['to']; |
|
81 | 81 | unset($query['col_filter'][$field]); |
82 | 82 | } |
83 | 83 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | // Pre-load any cfs that are links |
91 | 91 | $cf_preload = array(); |
92 | - foreach($cf_links as $field => $app) { |
|
93 | - foreach($selection as &$row) { |
|
94 | - if($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
92 | + foreach ($cf_links as $field => $app) { |
|
93 | + foreach ($selection as &$row) { |
|
94 | + if ($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
95 | 95 | } |
96 | - if($cf_preload[$app]){ |
|
96 | + if ($cf_preload[$app]) { |
|
97 | 97 | $selects[$field] = egw_link::titles($app, $cf_preload[$app]); |
98 | 98 | //error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app])); |
99 | 99 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | $this->export_records($this->export_object, $options, $selection, $ids); |
103 | 103 | $query['start'] += $query['num_rows']; |
104 | - } while($query['start'] < $query['total']); |
|
104 | + } while ($query['start'] < $query['total']); |
|
105 | 105 | |
106 | 106 | return $this->export_object; |
107 | 107 | break; |
108 | 108 | default: |
109 | - $ids = $selection = explode(',',$options['selection']); |
|
109 | + $ids = $selection = explode(',', $options['selection']); |
|
110 | 110 | $this->export_records($this->export_object, $options, $selection, $ids); |
111 | 111 | break; |
112 | 112 | } |
@@ -116,33 +116,33 @@ discard block |
||
116 | 116 | protected function export_records(&$export_object, $options, &$selection, $ids = array()) |
117 | 117 | { |
118 | 118 | // Pre-load links all at once |
119 | - if($ids && $options['mapping']['info_link_id']) |
|
119 | + if ($ids && $options['mapping']['info_link_id']) |
|
120 | 120 | { |
121 | 121 | $links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME); |
122 | - foreach($links as $id => $link) { |
|
123 | - if(!is_array($selection[$id])) break; |
|
122 | + foreach ($links as $id => $link) { |
|
123 | + if (!is_array($selection[$id])) break; |
|
124 | 124 | $selection[$id]['info_link_id'] = $link; |
125 | - if($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']); |
|
125 | + if ($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | // If exporting PM fields, pre-load them all at once |
129 | - if($ids && ($options['mapping']['pm_id'] || $options['mapping']['project'])) |
|
129 | + if ($ids && ($options['mapping']['pm_id'] || $options['mapping']['project'])) |
|
130 | 130 | { |
131 | 131 | $projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager'); |
132 | - foreach($projects as $id => $links) |
|
132 | + foreach ($projects as $id => $links) |
|
133 | 133 | { |
134 | - if(!is_array($selection[$id])) break; |
|
134 | + if (!is_array($selection[$id])) break; |
|
135 | 135 | $selection[$id]['pm_id'] = current($links); |
136 | 136 | $selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']); |
137 | - $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']); |
|
137 | + $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', $selection[$id]['pm_id']); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | foreach ($selection as $_identifier) { |
142 | - if(!is_array($_identifier)) { |
|
142 | + if (!is_array($_identifier)) { |
|
143 | 143 | $record = new infolog_egw_record($_identifier); |
144 | - if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
145 | - if($project = $projects[$record->info_id]) |
|
144 | + if ($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
145 | + if ($project = $projects[$record->info_id]) |
|
146 | 146 | { |
147 | 147 | $record->pm_id = current($project); |
148 | 148 | $record->project = egw_link::title('projectmanager', $record->pm_id); |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | $record->set_record($_identifier); |
153 | 153 | } |
154 | 154 | // Some conversion |
155 | - if($options['convert']) { |
|
155 | + if ($options['convert']) { |
|
156 | 156 | $this->selects['info_status'] = $this->bo->get_status($record->info_type); |
157 | 157 | importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects); |
158 | 158 | $this->convert($record); |
159 | 159 | |
160 | 160 | // Force 0 times to '' |
161 | - foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
|
161 | + foreach (array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
|
162 | 162 | { |
163 | - if($record->$field == 0) $record->$field = ''; |
|
163 | + if ($record->$field == 0) $record->$field = ''; |
|
164 | 164 | } |
165 | 165 | } else { |
166 | 166 | // Implode arrays, so they don't say 'Array' |
167 | - foreach($record->get_record_array() as $key => $value) { |
|
168 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
167 | + foreach ($record->get_record_array() as $key => $value) { |
|
168 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | $export_object->export_record($record); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | public function get_filename() |
212 | 212 | { |
213 | - if(is_object($this->export_object) && $this->export_object->get_num_of_records() == 1) |
|
213 | + if (is_object($this->export_object) && $this->export_object->get_num_of_records() == 1) |
|
214 | 214 | { |
215 | 215 | return $this->export_object->record->get_title(); |
216 | 216 | } |
@@ -240,18 +240,18 @@ discard block |
||
240 | 240 | { |
241 | 241 | $this->selects['info_type'] = $this->bo->enums['type']; |
242 | 242 | $this->selects['info_priority'] = $this->bo->enums['priority']; |
243 | - $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',false); |
|
243 | + $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist', false); |
|
244 | 244 | $this->selects['info_status'] = $this->bo->get_status(); |
245 | 245 | } |
246 | 246 | |
247 | 247 | public function get_filter_fields(Array &$filters) |
248 | 248 | { |
249 | - foreach($filters as $field_name => &$settings) |
|
249 | + foreach ($filters as $field_name => &$settings) |
|
250 | 250 | { |
251 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
251 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
252 | 252 | |
253 | 253 | // Infolog can't handle ranges in custom fields due to the way searching is done. |
254 | - if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]); |
|
254 | + if (strpos($field_name, '#') === 0 && strpos($settings['type'], 'date') === 0) unset($filters[$field_name]); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * |
261 | 261 | * This is for something specific to Infolog, in addition to the normal conversions. |
262 | 262 | */ |
263 | - public static function convert(infolog_egw_record &$record) { |
|
263 | + public static function convert(infolog_egw_record&$record) { |
|
264 | 264 | // Stub, for now |
265 | 265 | } |
266 | 266 | } |
@@ -14,10 +14,12 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * export plugin of infolog |
16 | 16 | */ |
17 | -class infolog_export_csv implements importexport_iface_export_plugin { |
|
17 | +class infolog_export_csv implements importexport_iface_export_plugin |
|
18 | +{ |
|
18 | 19 | |
19 | 20 | |
20 | - public function __construct() { |
|
21 | + public function __construct() |
|
22 | + { |
|
21 | 23 | translation::add_app('infolog'); |
22 | 24 | $this->bo = new infolog_bo(); |
23 | 25 | $this->get_selects(); |
@@ -28,7 +30,8 @@ discard block |
||
28 | 30 | * |
29 | 31 | * @param egw_record $_definition |
30 | 32 | */ |
31 | - public function export( $_stream, importexport_definition $_definition) { |
|
33 | + public function export( $_stream, importexport_definition $_definition) |
|
34 | + { |
|
32 | 35 | $options = $_definition->plugin_options; |
33 | 36 | |
34 | 37 | $selection = array(); |
@@ -48,8 +51,10 @@ discard block |
||
48 | 51 | case 'all': |
49 | 52 | // do we need to query the cf's |
50 | 53 | $query['custom_fields'] = false; |
51 | - foreach($options['mapping'] + (array)$_definition->filter as $field => $map) { |
|
52 | - if($field[0] == '#') { |
|
54 | + foreach($options['mapping'] + (array)$_definition->filter as $field => $map) |
|
55 | + { |
|
56 | + if($field[0] == '#') |
|
57 | + { |
|
53 | 58 | $query['custom_fields'] = true; |
54 | 59 | $query['selectcols'] .= ",$field"; |
55 | 60 | |
@@ -73,11 +78,20 @@ discard block |
||
73 | 78 | // Handle ranges |
74 | 79 | foreach($query['col_filter'] as $field => $value) |
75 | 80 | { |
76 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) continue; |
|
81 | + if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
82 | + { |
|
83 | + continue; |
|
84 | + } |
|
77 | 85 | |
78 | 86 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
79 | - if($value['from']) $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
80 | - if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
87 | + if($value['from']) |
|
88 | + { |
|
89 | + $query['col_filter'][] = "$field >= " . (int)$value['from']; |
|
90 | + } |
|
91 | + if($value['to']) |
|
92 | + { |
|
93 | + $query['col_filter'][] = "$field <= " . (int)$value['to']; |
|
94 | + } |
|
81 | 95 | unset($query['col_filter'][$field]); |
82 | 96 | } |
83 | 97 | } |
@@ -89,11 +103,17 @@ discard block |
||
89 | 103 | |
90 | 104 | // Pre-load any cfs that are links |
91 | 105 | $cf_preload = array(); |
92 | - foreach($cf_links as $field => $app) { |
|
93 | - foreach($selection as &$row) { |
|
94 | - if($row[$field]) $cf_preload[$app][] = $row[$field]; |
|
106 | + foreach($cf_links as $field => $app) |
|
107 | + { |
|
108 | + foreach($selection as &$row) |
|
109 | + { |
|
110 | + if($row[$field]) |
|
111 | + { |
|
112 | + $cf_preload[$app][] = $row[$field]; |
|
113 | + } |
|
95 | 114 | } |
96 | - if($cf_preload[$app]){ |
|
115 | + if($cf_preload[$app]) |
|
116 | + { |
|
97 | 117 | $selects[$field] = egw_link::titles($app, $cf_preload[$app]); |
98 | 118 | //error_log('Preload ' . $field . '['.$app . ']: ' . implode(',',$cf_preload[$app])); |
99 | 119 | } |
@@ -119,10 +139,17 @@ discard block |
||
119 | 139 | if($ids && $options['mapping']['info_link_id']) |
120 | 140 | { |
121 | 141 | $links = egw_link::get_links_multiple('infolog', $ids, true, '!'.egw_link::VFS_APPNAME); |
122 | - foreach($links as $id => $link) { |
|
123 | - if(!is_array($selection[$id])) break; |
|
142 | + foreach($links as $id => $link) |
|
143 | + { |
|
144 | + if(!is_array($selection[$id])) |
|
145 | + { |
|
146 | + break; |
|
147 | + } |
|
124 | 148 | $selection[$id]['info_link_id'] = $link; |
125 | - if($options['convert']) $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']); |
|
149 | + if($options['convert']) |
|
150 | + { |
|
151 | + $selection[$id]['info_link_id'] = egw_link::title($link['app'], $link['id']); |
|
152 | + } |
|
126 | 153 | } |
127 | 154 | } |
128 | 155 | // If exporting PM fields, pre-load them all at once |
@@ -131,28 +158,39 @@ discard block |
||
131 | 158 | $projects = egw_link::get_links_multiple('infolog', $ids, true, 'projectmanager'); |
132 | 159 | foreach($projects as $id => $links) |
133 | 160 | { |
134 | - if(!is_array($selection[$id])) break; |
|
161 | + if(!is_array($selection[$id])) |
|
162 | + { |
|
163 | + break; |
|
164 | + } |
|
135 | 165 | $selection[$id]['pm_id'] = current($links); |
136 | 166 | $selection[$id]['project'] = egw_link::title('projectmanager', $selection[$id]['pm_id']); |
137 | 167 | $this->selects['pl_id'] = ExecMethod('projectmanager.projectmanager_pricelist_bo.pricelist',$selection[$id]['pm_id']); |
138 | 168 | } |
139 | 169 | } |
140 | 170 | |
141 | - foreach ($selection as $_identifier) { |
|
142 | - if(!is_array($_identifier)) { |
|
171 | + foreach ($selection as $_identifier) |
|
172 | + { |
|
173 | + if(!is_array($_identifier)) |
|
174 | + { |
|
143 | 175 | $record = new infolog_egw_record($_identifier); |
144 | - if($link = $links[$record->info_id]) $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
176 | + if($link = $links[$record->info_id]) |
|
177 | + { |
|
178 | + $record->info_link_id = $options['convert'] ? egw_link::title($link['app'], $link['id']) : $link; |
|
179 | + } |
|
145 | 180 | if($project = $projects[$record->info_id]) |
146 | 181 | { |
147 | 182 | $record->pm_id = current($project); |
148 | 183 | $record->project = egw_link::title('projectmanager', $record->pm_id); |
149 | 184 | } |
150 | - } else { |
|
185 | + } |
|
186 | + else |
|
187 | + { |
|
151 | 188 | $record = new infolog_egw_record(); |
152 | 189 | $record->set_record($_identifier); |
153 | 190 | } |
154 | 191 | // Some conversion |
155 | - if($options['convert']) { |
|
192 | + if($options['convert']) |
|
193 | + { |
|
156 | 194 | $this->selects['info_status'] = $this->bo->get_status($record->info_type); |
157 | 195 | importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects); |
158 | 196 | $this->convert($record); |
@@ -160,12 +198,21 @@ discard block |
||
160 | 198 | // Force 0 times to '' |
161 | 199 | foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field) |
162 | 200 | { |
163 | - if($record->$field == 0) $record->$field = ''; |
|
201 | + if($record->$field == 0) |
|
202 | + { |
|
203 | + $record->$field = ''; |
|
204 | + } |
|
164 | 205 | } |
165 | - } else { |
|
206 | + } |
|
207 | + else |
|
208 | + { |
|
166 | 209 | // Implode arrays, so they don't say 'Array' |
167 | - foreach($record->get_record_array() as $key => $value) { |
|
168 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
210 | + foreach($record->get_record_array() as $key => $value) |
|
211 | + { |
|
212 | + if(is_array($value)) |
|
213 | + { |
|
214 | + $record->$key = implode(',', $value); |
|
215 | + } |
|
169 | 216 | } |
170 | 217 | } |
171 | 218 | $export_object->export_record($record); |
@@ -178,7 +225,8 @@ discard block |
||
178 | 225 | * |
179 | 226 | * @return string name |
180 | 227 | */ |
181 | - public static function get_name() { |
|
228 | + public static function get_name() |
|
229 | + { |
|
182 | 230 | return lang('Infolog CSV export'); |
183 | 231 | } |
184 | 232 | |
@@ -187,7 +235,8 @@ discard block |
||
187 | 235 | * |
188 | 236 | * @return string descriprion |
189 | 237 | */ |
190 | - public static function get_description() { |
|
238 | + public static function get_description() |
|
239 | + { |
|
191 | 240 | return lang("Exports Infolog entries into a CSV File."); |
192 | 241 | } |
193 | 242 | |
@@ -196,11 +245,13 @@ discard block |
||
196 | 245 | * |
197 | 246 | * @return string suffix |
198 | 247 | */ |
199 | - public static function get_filesuffix() { |
|
248 | + public static function get_filesuffix() |
|
249 | + { |
|
200 | 250 | return 'csv'; |
201 | 251 | } |
202 | 252 | |
203 | - public static function get_mimetype() { |
|
253 | + public static function get_mimetype() |
|
254 | + { |
|
204 | 255 | return 'text/csv'; |
205 | 256 | } |
206 | 257 | |
@@ -223,14 +274,16 @@ discard block |
||
223 | 274 | * |
224 | 275 | * @return string html |
225 | 276 | */ |
226 | - public function get_options_etpl() { |
|
277 | + public function get_options_etpl() |
|
278 | + { |
|
227 | 279 | } |
228 | 280 | |
229 | 281 | /** |
230 | 282 | * returns slectors of this plugin via xajax |
231 | 283 | * |
232 | 284 | */ |
233 | - public function get_selectors_etpl() { |
|
285 | + public function get_selectors_etpl() |
|
286 | + { |
|
234 | 287 | return array( |
235 | 288 | 'name' => 'infolog.export_csv_selectors', |
236 | 289 | ); |
@@ -248,10 +301,16 @@ discard block |
||
248 | 301 | { |
249 | 302 | foreach($filters as $field_name => &$settings) |
250 | 303 | { |
251 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
304 | + if($this->selects[$field_name]) |
|
305 | + { |
|
306 | + $settings['values'] = $this->selects[$field_name]; |
|
307 | + } |
|
252 | 308 | |
253 | 309 | // Infolog can't handle ranges in custom fields due to the way searching is done. |
254 | - if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) unset($filters[$field_name]); |
|
310 | + if(strpos($field_name, '#') === 0 && strpos($settings['type'],'date') === 0) |
|
311 | + { |
|
312 | + unset($filters[$field_name]); |
|
313 | + } |
|
255 | 314 | } |
256 | 315 | } |
257 | 316 | |
@@ -260,7 +319,8 @@ discard block |
||
260 | 319 | * |
261 | 320 | * This is for something specific to Infolog, in addition to the normal conversions. |
262 | 321 | */ |
263 | - public static function convert(infolog_egw_record &$record) { |
|
322 | + public static function convert(infolog_egw_record &$record) |
|
323 | + { |
|
264 | 324 | // Stub, for now |
265 | 325 | } |
266 | 326 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | $bo = new infolog_tracking(new infolog_bo()); |
22 | 22 | $this->export_fields = array('info_id' => 'Infolog ID', 'pm_id' => 'Project ID', 'project' => 'Project Name') + $bo->field2label; |
23 | 23 | // Add in created date, in the appropriate place |
24 | - $first = array_splice($this->export_fields, 0, array_search('info_datemodified',array_keys($this->export_fields))); |
|
24 | + $first = array_splice($this->export_fields, 0, array_search('info_datemodified', array_keys($this->export_fields))); |
|
25 | 25 | $this->export_fields = array_merge($first, array('info_created'=>'creation'), $this->export_fields); |
26 | 26 | |
27 | 27 | // Custom fields |
28 | 28 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 29 | $custom = Api\Storage\Customfields::get('infolog', true); |
30 | - foreach($custom as $name => $data) { |
|
30 | + foreach ($custom as $name => $data) { |
|
31 | 31 | $this->export_fields['#'.$name] = $data['label']; |
32 | 32 | } |
33 | 33 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class infolog_wizard_export_csv extends importexport_wizard_basic_export_csv |
16 | 16 | { |
17 | - public function __construct() { |
|
17 | + public function __construct() |
|
18 | + { |
|
18 | 19 | parent::__construct(); |
19 | 20 | |
20 | 21 | // Field mapping |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | // Custom fields |
28 | 29 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 30 | $custom = Api\Storage\Customfields::get('infolog', true); |
30 | - foreach($custom as $name => $data) { |
|
31 | + foreach($custom as $name => $data) |
|
32 | + { |
|
31 | 33 | $this->export_fields['#'.$name] = $data['label']; |
32 | 34 | } |
33 | 35 | } |
@@ -248,7 +248,7 @@ |
||
248 | 248 | $filtermethod .= " OR (".$this->responsible_filter($this->user). |
249 | 249 | ($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access |
250 | 250 | " OR info_status = 'offer' AND $public_access" : '').")". |
251 | - " AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')'; |
|
251 | + " AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')'; |
|
252 | 252 | } |
253 | 253 | elseif ($filter != 'my' && $filter != 'responsible') // none --> all entrys user has rights to see |
254 | 254 | { |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $ids = array( ); |
829 | 829 | if ($action == '' || $action == 'sp' || count($links)) |
830 | 830 | { |
831 | - $sql_query = "FROM $this->info_table main $join WHERE ($filtermethod $pid $sql_query) $link_extra"; |
|
831 | + $sql_query = "from $this->info_table main $join WHERE ($filtermethod $pid $sql_query) $link_extra"; |
|
832 | 832 | #error_log("infolog.so.search:\n" . print_r($sql_query, true)); |
833 | 833 | |
834 | 834 | if ($this->db->Type == 'mysql' && $this->db->ServerInfo['version'] >= 4.0) |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | } |
839 | 839 | else |
840 | 840 | { |
841 | - $query['total'] = $this->db->query($sql="SELECT $distinct main.info_id ".$sql_query,__LINE__,__FILE__)->NumRows(); |
|
841 | + $query['total'] = $this->db->query($sql="select $distinct main.info_id ".$sql_query,__LINE__,__FILE__)->NumRows(); |
|
842 | 842 | } |
843 | 843 | $info_customfield = ''; |
844 | 844 | if ($sortbycf != '') |
@@ -64,7 +64,6 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Constructor |
66 | 66 | * |
67 | - * @param array $grants=array() |
|
68 | 67 | * @return soinfolog |
69 | 68 | */ |
70 | 69 | function __construct( $grants=array() ) |
@@ -102,9 +101,9 @@ discard block |
||
102 | 101 | * |
103 | 102 | * @param array|int $info data or info_id of InfoLog entry |
104 | 103 | * @param int $required_rights EGW_ACL_xyz anded together |
105 | - * @param boolean $implicit_edit=false responsible has only implicit read and add rigths, unless this is set to true |
|
106 | - * @param array $grants=null grants to use, default (null) $this->grants |
|
107 | - * @param int $user=null user to check, default (null) $this->user |
|
104 | + * @param boolean $implicit_edit responsible has only implicit read and add rigths, unless this is set to true |
|
105 | + * @param array $grants grants to use, default (null) $this->grants |
|
106 | + * @param integer $user |
|
108 | 107 | * @return boolean True if access is granted else False |
109 | 108 | */ |
110 | 109 | function check_access( $info,$required_rights,$implicit_edit=false,array $grants=null,$user=null ) |
@@ -274,7 +273,7 @@ discard block |
||
274 | 273 | * generate sql to filter based on the status of the log-entry |
275 | 274 | * |
276 | 275 | * @param string $filter done = done or billed, open = not (done, billed, cancelled or deleted), offer = offer |
277 | - * @param boolean $prefix_and=true if true prefix the fileter with ' AND ' |
|
276 | + * @param boolean $prefix_and if true prefix the fileter with ' AND ' |
|
278 | 277 | * @return string the necesary sql |
279 | 278 | */ |
280 | 279 | function statusFilter($filter = '',$prefix_and=true) |
@@ -370,7 +369,7 @@ discard block |
||
370 | 369 | * some cacheing is done to prevent multiple reads of the same entry |
371 | 370 | * |
372 | 371 | * @param array $where where clause for entry to read |
373 | - * @return array|boolean the entry as array or False on error (eg. entry not found) |
|
372 | + * @return boolean the entry as array or False on error (eg. entry not found) |
|
374 | 373 | */ |
375 | 374 | function read(array $where) // did _not_ ensure ACL |
376 | 375 | { |
@@ -474,8 +473,6 @@ discard block |
||
474 | 473 | * changes or deletes entries with a spezified owner (for hook_delete_account) |
475 | 474 | * |
476 | 475 | * @param array $args hook arguments |
477 | - * @param int $args['account_id'] account to delete |
|
478 | - * @param int $args['new_owner']=0 new owner |
|
479 | 476 | */ |
480 | 477 | function change_delete_owner(array $args) // new_owner=0 means delete |
481 | 478 | { |
@@ -508,8 +505,8 @@ discard block |
||
508 | 505 | * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 |
509 | 506 | * |
510 | 507 | * @param array $values with the data of the log-entry |
511 | - * @param int $check_modified=0 old modification date to check before update (include in WHERE) |
|
512 | - * @param string $purge_cfs=null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs |
|
508 | + * @param int $check_modified old modification date to check before update (include in WHERE) |
|
509 | + * @param string $purge_cfs null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs |
|
513 | 510 | * @return int|boolean info_id, false on error or 0 if the entry has been updated in the meantime |
514 | 511 | */ |
515 | 512 | function write($values, $check_modified=0, $purge_cfs=null) // did _not_ ensure ACL |
@@ -662,19 +659,7 @@ discard block |
||
662 | 659 | /** |
663 | 660 | * searches InfoLog for a certain pattern in $query |
664 | 661 | * |
665 | - * @param string $query[order] column-name to sort after |
|
666 | - * @param string $query[sort] sort-order DESC or ASC |
|
667 | - * @param string $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' |
|
668 | - * @param int $query[cat_id] category to use or 0 or unset |
|
669 | - * @param string $query[search] pattern to search, search is done in info_from, info_subject and info_des |
|
670 | - * @param string $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used |
|
671 | 662 | * @param int &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries |
672 | - * @param array $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) |
|
673 | - * @param boolean $query[subs] return subs or not, if unset the user preference is used |
|
674 | - * @param int $query[num_rows] number of rows to return if $query[start] is set, default is to use the value from the general prefs |
|
675 | - * @param string|array $query[cols]=null what to query, if set the recordset / iterator get's returned |
|
676 | - * @param string $query[append]=null get's appended to sql query, eg. for GROUP BY |
|
677 | - * @param boolean $query['custom_fields']=false query custom-fields too, default not |
|
678 | 663 | * @return array|iterator with id's as key of the matching log-entries or recordset/iterator if cols is set |
679 | 664 | */ |
680 | 665 | function search(&$query) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param array $grants=array() |
68 | 68 | * @return soinfolog |
69 | 69 | */ |
70 | - function __construct( $grants=array() ) |
|
70 | + function __construct($grants = array()) |
|
71 | 71 | { |
72 | 72 | $this->db = clone($GLOBALS['egw']->db); |
73 | 73 | $this->db->set_app('infolog'); |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | * @param array $info infolog entry as array |
84 | 84 | * @return boolean |
85 | 85 | */ |
86 | - function is_responsible($info,$user=null) |
|
86 | + function is_responsible($info, $user = null) |
|
87 | 87 | { |
88 | 88 | if (!$user) $user = $this->user; |
89 | 89 | |
90 | 90 | static $um_cache = array(); |
91 | - if ($user == $this->user) $user_and_memberships =& $um_cache[$user]; |
|
91 | + if ($user == $this->user) $user_and_memberships = & $um_cache[$user]; |
|
92 | 92 | if (!isset($user_and_memberships)) |
93 | 93 | { |
94 | - $user_and_memberships = $GLOBALS['egw']->accounts->memberships($user,true); |
|
94 | + $user_and_memberships = $GLOBALS['egw']->accounts->memberships($user, true); |
|
95 | 95 | $user_and_memberships[] = $user; |
96 | 96 | } |
97 | - return $info['info_responsible'] && array_intersect((array)$info['info_responsible'],$user_and_memberships); |
|
97 | + return $info['info_responsible'] && array_intersect((array)$info['info_responsible'], $user_and_memberships); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param int $user=null user to check, default (null) $this->user |
108 | 108 | * @return boolean True if access is granted else False |
109 | 109 | */ |
110 | - function check_access( $info,$required_rights,$implicit_edit=false,array $grants=null,$user=null ) |
|
110 | + function check_access($info, $required_rights, $implicit_edit = false, array $grants = null, $user = null) |
|
111 | 111 | { |
112 | 112 | if (is_null($grants)) $grants = $this->grants; |
113 | 113 | if (!$user) $user = $this->user; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | |
121 | 121 | } |
122 | - elseif ((int) $info != $this->data['info_id']) // already loaded? |
|
122 | + elseif ((int)$info != $this->data['info_id']) // already loaded? |
|
123 | 123 | { |
124 | 124 | // dont change our own internal data, |
125 | 125 | $backup_data = $this->data; |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | return False; |
136 | 136 | } |
137 | 137 | $owner = $info['info_owner']; |
138 | - $access_ok = $owner == $user || // user has all rights |
|
138 | + $access_ok = $owner == $user || // user has all rights |
|
139 | 139 | // ACL only on public entrys || $owner granted _PRIVATE |
140 | - (!!($grants[$owner] & $required_rights) || |
|
141 | - $this->is_responsible($info,$user) && // implicite rights for responsible user(s) and his memberships |
|
140 | + (!!($grants[$owner]&$required_rights) || |
|
141 | + $this->is_responsible($info, $user) && // implicite rights for responsible user(s) and his memberships |
|
142 | 142 | ($required_rights == EGW_ACL_READ || $required_rights == EGW_ACL_ADD || $implicit_edit && $required_rights == EGW_ACL_EDIT)) && |
143 | - ($info['info_access'] == 'public' || !!($this->grants[$user] & EGW_ACL_PRIVATE)); |
|
143 | + ($info['info_access'] == 'public' || !!($this->grants[$user]&EGW_ACL_PRIVATE)); |
|
144 | 144 | |
145 | 145 | // error_log(__METHOD__."($info[info_id],$required_rights,$implicit_edit,".array2string($grants).",$user) returning ".array2string($access_ok)); |
146 | 146 | return $access_ok; |
@@ -159,23 +159,22 @@ discard block |
||
159 | 159 | if (!$users) return '0'; |
160 | 160 | |
161 | 161 | $responsible = array(); |
162 | - foreach((array)$users as $user) |
|
162 | + foreach ((array)$users as $user) |
|
163 | 163 | { |
164 | - $responsible = array_merge($responsible,(array) |
|
165 | - ($user > 0 ? $GLOBALS['egw']->accounts->memberships($user,true) : |
|
166 | - $GLOBALS['egw']->accounts->members($user,true))); |
|
164 | + $responsible = array_merge($responsible, (array) |
|
165 | + ($user > 0 ? $GLOBALS['egw']->accounts->memberships($user, true) : $GLOBALS['egw']->accounts->members($user, true))); |
|
167 | 166 | $responsible[] = $user; |
168 | 167 | } |
169 | 168 | if (is_array($users)) |
170 | 169 | { |
171 | 170 | $responsible = array_unique($responsible); |
172 | 171 | } |
173 | - foreach($responsible as $key => $uid) |
|
172 | + foreach ($responsible as $key => $uid) |
|
174 | 173 | { |
175 | - $responsible[$key] = $this->db->concat("','",'info_responsible',"','")." LIKE '%,$uid,%'"; |
|
174 | + $responsible[$key] = $this->db->concat("','", 'info_responsible', "','")." LIKE '%,$uid,%'"; |
|
176 | 175 | } |
177 | 176 | //echo "<p align=right>responsible_filter($user) = ".'('.implode(' OR ',$responsible).')'."</p>\n"; |
178 | - return '('.implode(' OR ',$responsible).')'; |
|
177 | + return '('.implode(' OR ', $responsible).')'; |
|
179 | 178 | } |
180 | 179 | |
181 | 180 | /** |
@@ -190,17 +189,17 @@ discard block |
||
190 | 189 | function aclFilter($filter = False) |
191 | 190 | { |
192 | 191 | $vars = null; |
193 | - preg_match('/(my|responsible|delegated|own|privat|private|all|user)([0-9,-]*)/',$filter_was=$filter,$vars); |
|
192 | + preg_match('/(my|responsible|delegated|own|privat|private|all|user)([0-9,-]*)/', $filter_was = $filter, $vars); |
|
194 | 193 | $filter = $vars[1]; |
195 | 194 | $f_user = $vars[2]; |
196 | 195 | |
197 | 196 | if (isset($this->acl_filter[$filter.$f_user])) |
198 | 197 | { |
199 | - return $this->acl_filter[$filter.$f_user]; // used cached filter if found |
|
198 | + return $this->acl_filter[$filter.$f_user]; // used cached filter if found |
|
200 | 199 | } |
201 | - if ($f_user && strpos($f_user,',') !== false) |
|
200 | + if ($f_user && strpos($f_user, ',') !== false) |
|
202 | 201 | { |
203 | - $f_user = explode(',',$f_user); |
|
202 | + $f_user = explode(',', $f_user); |
|
204 | 203 | } |
205 | 204 | |
206 | 205 | $filtermethod = " (info_owner=$this->user"; // user has all rights |
@@ -217,24 +216,24 @@ discard block |
||
217 | 216 | { |
218 | 217 | if (is_array($this->grants)) |
219 | 218 | { |
220 | - foreach($this->grants as $user => $grant) |
|
219 | + foreach ($this->grants as $user => $grant) |
|
221 | 220 | { |
222 | 221 | // echo "<p>grants: user=$user, grant=$grant</p>"; |
223 | - if ($grant & (EGW_ACL_READ|EGW_ACL_EDIT)) |
|
222 | + if ($grant&(EGW_ACL_READ|EGW_ACL_EDIT)) |
|
224 | 223 | { |
225 | 224 | $public_user_list[] = $user; |
226 | 225 | } |
227 | - if ($grant & EGW_ACL_PRIVATE) |
|
226 | + if ($grant&EGW_ACL_PRIVATE) |
|
228 | 227 | { |
229 | 228 | $private_user_list[] = $user; |
230 | 229 | } |
231 | 230 | } |
232 | 231 | if (count($private_user_list)) |
233 | 232 | { |
234 | - $has_private_access = $this->db->expression($this->info_table,array('info_owner' => $private_user_list)); |
|
233 | + $has_private_access = $this->db->expression($this->info_table, array('info_owner' => $private_user_list)); |
|
235 | 234 | } |
236 | 235 | } |
237 | - $public_access = $this->db->expression($this->info_table,array('info_owner' => $public_user_list)); |
|
236 | + $public_access = $this->db->expression($this->info_table, array('info_owner' => $public_user_list)); |
|
238 | 237 | // implicit read-rights for responsible user |
239 | 238 | $filtermethod .= " OR (".$this->responsible_filter($this->user).')'; |
240 | 239 | |
@@ -242,9 +241,9 @@ discard block |
||
242 | 241 | if ($filter == 'private' || $filter == 'privat' || $filter == 'own') |
243 | 242 | { |
244 | 243 | $filtermethod .= " OR (".$this->responsible_filter($this->user). |
245 | - ($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access |
|
244 | + ($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access |
|
246 | 245 | " OR info_status = 'offer' AND $public_access" : '').")". |
247 | - " AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')'; |
|
246 | + " AND (info_access='public'".($has_private_access ? " OR $has_private_access" : '').')'; |
|
248 | 247 | } |
249 | 248 | elseif ($filter != 'my' && $filter != 'responsible') // none --> all entrys user has rights to see |
250 | 249 | { |
@@ -261,13 +260,13 @@ discard block |
||
261 | 260 | |
262 | 261 | if ($filter == 'user' && $f_user) |
263 | 262 | { |
264 | - $filtermethod .= $this->db->expression($this->info_table,' AND (',array( |
|
263 | + $filtermethod .= $this->db->expression($this->info_table, ' AND (', array( |
|
265 | 264 | 'info_owner' => $f_user, |
266 | - )," AND info_responsible='0' OR ",$this->responsible_filter($f_user),')'); |
|
265 | + ), " AND info_responsible='0' OR ", $this->responsible_filter($f_user), ')'); |
|
267 | 266 | } |
268 | 267 | } |
269 | 268 | //echo "<p>aclFilter(filter='$filter_was',user='$f_user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n"; |
270 | - return $this->acl_filter[$filter.$f_user] = $filtermethod; // cache the filter |
|
269 | + return $this->acl_filter[$filter.$f_user] = $filtermethod; // cache the filter |
|
271 | 270 | } |
272 | 271 | |
273 | 272 | /** |
@@ -277,18 +276,18 @@ discard block |
||
277 | 276 | * @param boolean $prefix_and=true if true prefix the fileter with ' AND ' |
278 | 277 | * @return string the necesary sql |
279 | 278 | */ |
280 | - function statusFilter($filter = '',$prefix_and=true) |
|
279 | + function statusFilter($filter = '', $prefix_and = true) |
|
281 | 280 | { |
282 | 281 | $vars = null; |
283 | - preg_match('/(done|open|offer|deleted|\+deleted)/',$filter,$vars); |
|
282 | + preg_match('/(done|open|offer|deleted|\+deleted)/', $filter, $vars); |
|
284 | 283 | $filter = $vars[1]; |
285 | 284 | |
286 | 285 | switch ($filter) |
287 | 286 | { |
288 | 287 | case 'done': $filter = "info_status IN ('done','billed','cancelled')"; break; |
289 | 288 | case 'open': $filter = "NOT (info_status IN ('done','billed','cancelled','deleted','template','nonactive','archive'))"; break; |
290 | - case 'offer': $filter = "info_status = 'offer'"; break; |
|
291 | - case 'deleted': $filter = "info_status = 'deleted'"; break; |
|
289 | + case 'offer': $filter = "info_status = 'offer'"; break; |
|
290 | + case 'deleted': $filter = "info_status = 'deleted'"; break; |
|
292 | 291 | case '+deleted':$filter = "NOT (info_status IN ('template','nonactive','archive'))"; break; |
293 | 292 | default: $filter = "NOT (info_status IN ('deleted','template','nonactive','archive'))"; break; |
294 | 293 | } |
@@ -309,18 +308,18 @@ discard block |
||
309 | 308 | function dateFilter($filter = '') |
310 | 309 | { |
311 | 310 | $vars = null; |
312 | - preg_match('/(open-upcoming|upcoming|today|overdue|date|enddate)([-\\/.0-9]*)/',$filter,$vars); |
|
311 | + preg_match('/(open-upcoming|upcoming|today|overdue|date|enddate)([-\\/.0-9]*)/', $filter, $vars); |
|
313 | 312 | $filter = $vars[1]; |
314 | 313 | |
315 | - if (isset($vars[2]) && !empty($vars[2]) && ($date = preg_split('/[-\\/.]/',$vars[2]))) |
|
314 | + if (isset($vars[2]) && !empty($vars[2]) && ($date = preg_split('/[-\\/.]/', $vars[2]))) |
|
316 | 315 | { |
317 | - $today = mktime(-$this->tz_offset,0,0,intval($date[1]),intval($date[2]),intval($date[0])); |
|
318 | - $tomorrow = mktime(-$this->tz_offset,0,0,intval($date[1]),intval($date[2])+1,intval($date[0])); |
|
316 | + $today = mktime(-$this->tz_offset, 0, 0, intval($date[1]), intval($date[2]), intval($date[0])); |
|
317 | + $tomorrow = mktime(-$this->tz_offset, 0, 0, intval($date[1]), intval($date[2]) + 1, intval($date[0])); |
|
319 | 318 | } |
320 | 319 | else |
321 | 320 | { |
322 | - $now = getdate(time()-60*60*$this->tz_offset); |
|
323 | - $tomorrow = mktime(-$this->tz_offset,0,0,$now['mon'],$now['mday']+1,$now['year']); |
|
321 | + $now = getdate(time() - 60 * 60 * $this->tz_offset); |
|
322 | + $tomorrow = mktime(-$this->tz_offset, 0, 0, $now['mon'], $now['mday'] + 1, $now['year']); |
|
324 | 323 | } |
325 | 324 | switch ($filter) |
326 | 325 | { |
@@ -384,7 +383,7 @@ discard block |
||
384 | 383 | $minimum_uid_length = 8; |
385 | 384 | } |
386 | 385 | |
387 | - if (!$where || !($this->data = $this->db->select($this->info_table,'*',$where,__LINE__,__FILE__)->fetch())) |
|
386 | + if (!$where || !($this->data = $this->db->select($this->info_table, '*', $where, __LINE__, __FILE__)->fetch())) |
|
388 | 387 | { |
389 | 388 | $this->init( ); |
390 | 389 | //error_log(__METHOD__.'('.array2string($where).') returning FALSE'); |
@@ -396,15 +395,15 @@ discard block |
||
396 | 395 | $this->data['info_uid'] = common::generate_uid('infolog', $this->data['info_id']); |
397 | 396 | $this->db->update($this->info_table, |
398 | 397 | array('info_uid' => $this->data['info_uid']), |
399 | - array('info_id' => $this->data['info_id']), __LINE__,__FILE__); |
|
398 | + array('info_id' => $this->data['info_id']), __LINE__, __FILE__); |
|
400 | 399 | } |
401 | 400 | if (!is_array($this->data['info_responsible'])) |
402 | 401 | { |
403 | - $this->data['info_responsible'] = $this->data['info_responsible'] ? explode(',',$this->data['info_responsible']) : array(); |
|
402 | + $this->data['info_responsible'] = $this->data['info_responsible'] ? explode(',', $this->data['info_responsible']) : array(); |
|
404 | 403 | } |
405 | 404 | // Cast back to integer |
406 | 405 | $this->data['info_id_parent'] = (int)$this->data['info_id_parent']; |
407 | - foreach($this->db->select($this->extra_table,'info_extra_name,info_extra_value',array('info_id'=>$this->data['info_id']),__LINE__,__FILE__) as $row) |
|
406 | + foreach ($this->db->select($this->extra_table, 'info_extra_name,info_extra_value', array('info_id'=>$this->data['info_id']), __LINE__, __FILE__) as $row) |
|
408 | 407 | { |
409 | 408 | $this->data['#'.$row['info_extra_name']] = $row['info_extra_value']; |
410 | 409 | } |
@@ -419,17 +418,17 @@ discard block |
||
419 | 418 | * @param boolean $delete_children delete the children, if not set there parent-id to $new_parent |
420 | 419 | * @param int $new_parent new parent-id to set for subs |
421 | 420 | */ |
422 | - function delete($info_id,$delete_children=True,$new_parent=0) // did _not_ ensure ACL |
|
421 | + function delete($info_id, $delete_children = True, $new_parent = 0) // did _not_ ensure ACL |
|
423 | 422 | { |
424 | 423 | //echo "<p>soinfolog::delete($info_id,'$delete_children',$new_parent)</p>\n"; |
425 | - if ((int) $info_id <= 0) |
|
424 | + if ((int)$info_id <= 0) |
|
426 | 425 | { |
427 | 426 | return; |
428 | 427 | } |
429 | - $this->db->delete($this->info_table,array('info_id'=>$info_id),__LINE__,__FILE__); |
|
430 | - $this->db->delete($this->extra_table,array('info_id'=>$info_id),__LINE__,__FILE__); |
|
431 | - egw_link::unlink(0,'infolog',$info_id); |
|
432 | - egw_index::delete('infolog',$info_id); |
|
428 | + $this->db->delete($this->info_table, array('info_id'=>$info_id), __LINE__, __FILE__); |
|
429 | + $this->db->delete($this->extra_table, array('info_id'=>$info_id), __LINE__, __FILE__); |
|
430 | + egw_link::unlink(0, 'infolog', $info_id); |
|
431 | + egw_index::delete('infolog', $info_id); |
|
433 | 432 | |
434 | 433 | if ($this->data['info_id'] == $info_id) |
435 | 434 | { |
@@ -438,18 +437,18 @@ discard block |
||
438 | 437 | // delete children, if they are owned by the user |
439 | 438 | if ($delete_children) |
440 | 439 | { |
441 | - $db2 = clone($this->db); // we need an extra result-set |
|
442 | - $db2->select($this->info_table,'info_id',array( |
|
440 | + $db2 = clone($this->db); // we need an extra result-set |
|
441 | + $db2->select($this->info_table, 'info_id', array( |
|
443 | 442 | 'info_id_parent' => $info_id, |
444 | 443 | 'info_owner' => $this->user, |
445 | - ),__LINE__,__FILE__); |
|
444 | + ), __LINE__, __FILE__); |
|
446 | 445 | while ($db2->next_record()) |
447 | 446 | { |
448 | - $this->delete($db2->f(0),$delete_children); |
|
447 | + $this->delete($db2->f(0), $delete_children); |
|
449 | 448 | } |
450 | 449 | } |
451 | 450 | // set parent_id to $new_parent or 0 for all not deleted children |
452 | - $this->db->update($this->info_table,array('info_id_parent'=>$new_parent),array('info_id_parent'=>$info_id),__LINE__,__FILE__); |
|
451 | + $this->db->update($this->info_table, array('info_id_parent'=>$new_parent), array('info_id_parent'=>$info_id), __LINE__, __FILE__); |
|
453 | 452 | } |
454 | 453 | |
455 | 454 | /** |
@@ -461,9 +460,9 @@ discard block |
||
461 | 460 | function get_children($info_id) |
462 | 461 | { |
463 | 462 | $children = array(); |
464 | - foreach($this->db->select($this->info_table, 'info_id,info_owner', array( |
|
463 | + foreach ($this->db->select($this->info_table, 'info_id,info_owner', array( |
|
465 | 464 | 'info_id_parent' => $info_id, |
466 | - ),__LINE__,__FILE__) as $row) |
|
465 | + ), __LINE__, __FILE__) as $row) |
|
467 | 466 | { |
468 | 467 | $children[$row['info_id']] = $row['info_owner']; |
469 | 468 | } |
@@ -479,27 +478,27 @@ discard block |
||
479 | 478 | */ |
480 | 479 | function change_delete_owner(array $args) // new_owner=0 means delete |
481 | 480 | { |
482 | - if (!(int) $args['new_owner']) |
|
481 | + if (!(int)$args['new_owner']) |
|
483 | 482 | { |
484 | - foreach($this->db->select($this->info_table,'info_id',array('info_owner'=>$args['account_id']),__LINE__,__FILE__,false,'','infolog') as $row) |
|
483 | + foreach ($this->db->select($this->info_table, 'info_id', array('info_owner'=>$args['account_id']), __LINE__, __FILE__, false, '', 'infolog') as $row) |
|
485 | 484 | { |
486 | - $this->delete($row['info_id'],False); |
|
485 | + $this->delete($row['info_id'], False); |
|
487 | 486 | } |
488 | 487 | } |
489 | 488 | else |
490 | 489 | { |
491 | - $this->db->update($this->info_table,array('info_owner'=>$args['new_owner']),array('info_owner'=>$args['account_id']),__LINE__,__FILE__,'infolog'); |
|
490 | + $this->db->update($this->info_table, array('info_owner'=>$args['new_owner']), array('info_owner'=>$args['account_id']), __LINE__, __FILE__, 'infolog'); |
|
492 | 491 | } |
493 | - foreach($this->db->select($this->info_table,'info_id,info_responsible', |
|
494 | - $this->db->concat("','",'info_responsible',"','").' LIKE '.$this->db->quote('%,'.(int)$args['account_id'].',%'), |
|
495 | - __LINE__,__FILE__,false,'','infolog') as $row) |
|
492 | + foreach ($this->db->select($this->info_table, 'info_id,info_responsible', |
|
493 | + $this->db->concat("','", 'info_responsible', "','").' LIKE '.$this->db->quote('%,'.(int)$args['account_id'].',%'), |
|
494 | + __LINE__, __FILE__, false, '', 'infolog') as $row) |
|
496 | 495 | { |
497 | - $new_responsible = explode(',',$row['info_responsible']); |
|
498 | - unset($new_responsible[array_search($args['account_id'],$new_responsible)]); |
|
496 | + $new_responsible = explode(',', $row['info_responsible']); |
|
497 | + unset($new_responsible[array_search($args['account_id'], $new_responsible)]); |
|
499 | 498 | if ((int)$args['new_owner']) $new_responsible[] = (int)$args['new_owner']; |
500 | - $this->db->update($this->info_table,array( |
|
501 | - 'info_responsible' => implode(',',$new_responsible), |
|
502 | - ),array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog'); |
|
499 | + $this->db->update($this->info_table, array( |
|
500 | + 'info_responsible' => implode(',', $new_responsible), |
|
501 | + ), array('info_id' => $row['info_id']), __LINE__, __FILE__, 'infolog'); |
|
503 | 502 | } |
504 | 503 | |
505 | 504 | } |
@@ -512,7 +511,7 @@ discard block |
||
512 | 511 | * @param string $purge_cfs=null null=dont, 'ical'=only iCal X-properties (cfs name starting with "#"), 'all'=all cfs |
513 | 512 | * @return int|boolean info_id, false on error or 0 if the entry has been updated in the meantime |
514 | 513 | */ |
515 | - function write($values, $check_modified=0, $purge_cfs=null) // did _not_ ensure ACL |
|
514 | + function write($values, $check_modified = 0, $purge_cfs = null) // did _not_ ensure ACL |
|
516 | 515 | { |
517 | 516 | if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) |
518 | 517 | { |
@@ -524,19 +523,19 @@ discard block |
||
524 | 523 | } |
525 | 524 | |
526 | 525 | //echo "soinfolog::write(,$check_modified) values="; _debug_array($values); |
527 | - $info_id = (int) $values['info_id']; |
|
526 | + $info_id = (int)$values['info_id']; |
|
528 | 527 | |
529 | - if (array_key_exists('info_responsible',$values)) // isset($values['info_responsible']) returns false for NULL! |
|
528 | + if (array_key_exists('info_responsible', $values)) // isset($values['info_responsible']) returns false for NULL! |
|
530 | 529 | { |
531 | - $values['info_responsible'] = $values['info_responsible'] ? implode(',',$values['info_responsible']) : '0'; |
|
530 | + $values['info_responsible'] = $values['info_responsible'] ? implode(',', $values['info_responsible']) : '0'; |
|
532 | 531 | } |
533 | - $table_def = $this->db->get_table_definitions('infolog',$this->info_table); |
|
532 | + $table_def = $this->db->get_table_definitions('infolog', $this->info_table); |
|
534 | 533 | $to_write = array(); |
535 | - foreach($values as $key => $val) |
|
534 | + foreach ($values as $key => $val) |
|
536 | 535 | { |
537 | 536 | if ($key != 'info_id' && isset($table_def['fd'][$key])) |
538 | 537 | { |
539 | - $to_write[$key] = $this->data[$key] = $val; // update internal data |
|
538 | + $to_write[$key] = $this->data[$key] = $val; // update internal data |
|
540 | 539 | } |
541 | 540 | } |
542 | 541 | // writing no price as SQL NULL (required by postgres) |
@@ -546,23 +545,23 @@ discard block |
||
546 | 545 | { |
547 | 546 | $where = array('info_id' => $info_id); |
548 | 547 | if ($check_modified) $where['info_datemodified'] = $check_modified; |
549 | - if (!$this->db->update($this->info_table,$to_write,$where,__LINE__,__FILE__)) |
|
548 | + if (!$this->db->update($this->info_table, $to_write, $where, __LINE__, __FILE__)) |
|
550 | 549 | { |
551 | 550 | //error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning false"); |
552 | - return false; // Error |
|
551 | + return false; // Error |
|
553 | 552 | } |
554 | 553 | if ($check_modified && $this->db->affected_rows() < 1) |
555 | 554 | { |
556 | 555 | //error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning 0 (nothing updated, eg. condition not met)"); |
557 | - return 0; // someone else updated the modtime or deleted the entry |
|
556 | + return 0; // someone else updated the modtime or deleted the entry |
|
558 | 557 | } |
559 | 558 | } |
560 | 559 | else |
561 | 560 | { |
562 | - if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0; // must not be null |
|
561 | + if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0; // must not be null |
|
563 | 562 | |
564 | - $this->db->insert($this->info_table,$to_write,false,__LINE__,__FILE__); |
|
565 | - $info_id = $this->data['info_id'] = $this->db->get_last_insert_id($this->info_table,'info_id'); |
|
563 | + $this->db->insert($this->info_table, $to_write, false, __LINE__, __FILE__); |
|
564 | + $info_id = $this->data['info_id'] = $this->db->get_last_insert_id($this->info_table, 'info_id'); |
|
566 | 565 | } |
567 | 566 | |
568 | 567 | $update = array(); |
@@ -578,8 +577,8 @@ discard block |
||
578 | 577 | } |
579 | 578 | if ($update) |
580 | 579 | { |
581 | - $this->db->update($this->info_table,$update, |
|
582 | - array('info_id' => $info_id), __LINE__,__FILE__); |
|
580 | + $this->db->update($this->info_table, $update, |
|
581 | + array('info_id' => $info_id), __LINE__, __FILE__); |
|
583 | 582 | } |
584 | 583 | |
585 | 584 | //echo "<p>soinfolog.write values= "; _debug_array($values); |
@@ -589,38 +588,38 @@ discard block |
||
589 | 588 | { |
590 | 589 | $where = array('info_id' => $info_id); |
591 | 590 | if ($purge_cfs == 'ical') $where[] = "info_extra_name LIKE '#%'"; |
592 | - $this->db->delete($this->extra_table,$where,__LINE__,__FILE__); |
|
591 | + $this->db->delete($this->extra_table, $where, __LINE__, __FILE__); |
|
593 | 592 | } |
594 | 593 | $to_delete = array(); |
595 | - foreach($values as $key => $val) |
|
594 | + foreach ($values as $key => $val) |
|
596 | 595 | { |
597 | 596 | if ($key[0] != '#') |
598 | 597 | { |
599 | - continue; // no customfield |
|
598 | + continue; // no customfield |
|
600 | 599 | } |
601 | - $this->data[$key] = $val; // update internal data |
|
600 | + $this->data[$key] = $val; // update internal data |
|
602 | 601 | |
603 | 602 | if ($val) |
604 | 603 | { |
605 | - $this->db->insert($this->extra_table,array( |
|
604 | + $this->db->insert($this->extra_table, array( |
|
606 | 605 | // store multivalued CalDAV properties as serialized array, everything else get comma-separated |
607 | - 'info_extra_value' => is_array($val) ? ($key[1] == '#' ? serialize($val) : implode(',',$val)) : $val, |
|
608 | - ),array( |
|
606 | + 'info_extra_value' => is_array($val) ? ($key[1] == '#' ? serialize($val) : implode(',', $val)) : $val, |
|
607 | + ), array( |
|
609 | 608 | 'info_id' => $info_id, |
610 | - 'info_extra_name' => substr($key,1), |
|
611 | - ),__LINE__,__FILE__); |
|
609 | + 'info_extra_name' => substr($key, 1), |
|
610 | + ), __LINE__, __FILE__); |
|
612 | 611 | } |
613 | 612 | else |
614 | 613 | { |
615 | - $to_delete[] = substr($key,1); |
|
614 | + $to_delete[] = substr($key, 1); |
|
616 | 615 | } |
617 | 616 | } |
618 | 617 | if ($to_delete && !$purge_cfs) |
619 | 618 | { |
620 | - $this->db->delete($this->extra_table,array( |
|
619 | + $this->db->delete($this->extra_table, array( |
|
621 | 620 | 'info_id' => $info_id, |
622 | 621 | 'info_extra_name' => $to_delete, |
623 | - ),__LINE__,__FILE__); |
|
622 | + ), __LINE__, __FILE__); |
|
624 | 623 | } |
625 | 624 | // echo "<p>soinfolog.write this->data= "; _debug_array($this->data); |
626 | 625 | //error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning id=".$this->data['info_id']); |
@@ -640,18 +639,18 @@ discard block |
||
640 | 639 | * @param int|array $info_id id(s) of log-entry |
641 | 640 | * @return int|array the number of sub-entries or indexed by info_id, if array as param given |
642 | 641 | */ |
643 | - function anzSubs( $info_id ) |
|
642 | + function anzSubs($info_id) |
|
644 | 643 | { |
645 | 644 | if (!is_array($info_id) || !$info_id) |
646 | 645 | { |
647 | 646 | if ((int)$info_id <= 0) return 0; |
648 | 647 | } |
649 | 648 | $counts = array(); |
650 | - foreach($this->db->select($this->info_table,'info_id_parent,COUNT(*) AS info_anz_subs',array( |
|
649 | + foreach ($this->db->select($this->info_table, 'info_id_parent,COUNT(*) AS info_anz_subs', array( |
|
651 | 650 | 'info_id_parent' => $info_id, |
652 | - "info_status != 'deleted'", // dont count deleted subs as subs, as they are not shown by default |
|
653 | - ),__LINE__,__FILE__, |
|
654 | - false,'GROUP BY info_id_parent','infolog') as $row) |
|
651 | + "info_status != 'deleted'", // dont count deleted subs as subs, as they are not shown by default |
|
652 | + ), __LINE__, __FILE__, |
|
653 | + false, 'GROUP BY info_id_parent', 'infolog') as $row) |
|
655 | 654 | { |
656 | 655 | $counts[$row['info_id_parent']] = (int)$row['info_anz_subs']; |
657 | 656 | } |
@@ -691,102 +690,102 @@ discard block |
||
691 | 690 | $action = isset($action2app[$query['action']]) ? $action2app[$query['action']] : $query['action']; |
692 | 691 | if ($action) |
693 | 692 | { |
694 | - $links = solink::get_links($action=='sp'?'infolog':$action, |
|
695 | - is_array($query['action_id']) ? $query['action_id'] : explode(',',$query['action_id']),'infolog','',$query['col_filter']['info_status'] =='deleted'); |
|
693 | + $links = solink::get_links($action == 'sp' ? 'infolog' : $action, |
|
694 | + is_array($query['action_id']) ? $query['action_id'] : explode(',', $query['action_id']), 'infolog', '', $query['col_filter']['info_status'] == 'deleted'); |
|
696 | 695 | |
697 | 696 | if (count($links)) |
698 | 697 | { |
699 | - $links = call_user_func_array('array_merge',$links); // flatten the array |
|
700 | - $link_extra = ($action == 'sp' ? 'OR' : 'AND')." main.info_id IN (".implode(',',$links).')'; |
|
698 | + $links = call_user_func_array('array_merge', $links); // flatten the array |
|
699 | + $link_extra = ($action == 'sp' ? 'OR' : 'AND')." main.info_id IN (".implode(',', $links).')'; |
|
701 | 700 | } |
702 | 701 | } |
703 | 702 | } |
704 | - $sortbycf=''; |
|
705 | - if (!empty($query['order']) && (preg_match('/^[a-z_0-9, ]+$/i',$query['order']) || stripos($query['order'],'#')!==FALSE ) && |
|
706 | - (empty($query['sort']) || preg_match('/^(DESC|ASC)$/i',$query['sort']))) |
|
703 | + $sortbycf = ''; |
|
704 | + if (!empty($query['order']) && (preg_match('/^[a-z_0-9, ]+$/i', $query['order']) || stripos($query['order'], '#') !== FALSE) && |
|
705 | + (empty($query['sort']) || preg_match('/^(DESC|ASC)$/i', $query['sort']))) |
|
707 | 706 | { |
708 | 707 | $order = array(); |
709 | - foreach(explode(',',$query['order']) as $val) |
|
708 | + foreach (explode(',', $query['order']) as $val) |
|
710 | 709 | { |
711 | 710 | $val = trim($val); |
712 | 711 | if ($val[0] == '#') |
713 | 712 | { |
714 | - $sortbycf = substr($val,1); |
|
713 | + $sortbycf = substr($val, 1); |
|
715 | 714 | $val = "cfsortcrit IS NULL,cfsortcrit"; |
716 | 715 | } |
717 | 716 | else |
718 | 717 | { |
719 | 718 | static $table_def = null; |
720 | - if (is_null($table_def)) $table_def = $this->db->get_table_definitions('infolog',$this->info_table); |
|
721 | - if (substr($val,0,5) != 'info_' && isset($table_def['fd']['info_'.$val])) $val = 'info_'.$val; |
|
719 | + if (is_null($table_def)) $table_def = $this->db->get_table_definitions('infolog', $this->info_table); |
|
720 | + if (substr($val, 0, 5) != 'info_' && isset($table_def['fd']['info_'.$val])) $val = 'info_'.$val; |
|
722 | 721 | if ($val == 'info_des' && $this->db->capabilities['order_on_text'] !== true) |
723 | 722 | { |
724 | 723 | if (!$this->db->capabilities['order_on_text']) continue; |
725 | 724 | |
726 | - $val = sprintf($this->db->capabilities['order_on_text'],$val); |
|
725 | + $val = sprintf($this->db->capabilities['order_on_text'], $val); |
|
727 | 726 | } |
728 | 727 | } |
729 | 728 | $order[] = $val; |
730 | 729 | } |
731 | - $ordermethod = 'ORDER BY ' . implode(',',$order) . ' ' . $query['sort']; |
|
730 | + $ordermethod = 'ORDER BY '.implode(',', $order).' '.$query['sort']; |
|
732 | 731 | } |
733 | 732 | else |
734 | 733 | { |
735 | - $ordermethod = 'ORDER BY info_datemodified DESC'; // newest first |
|
734 | + $ordermethod = 'ORDER BY info_datemodified DESC'; // newest first |
|
736 | 735 | } |
737 | 736 | $filtermethod = $this->aclFilter($query['filter']); |
738 | 737 | if (!$query['col_filter']['info_status']) $filtermethod .= $this->statusFilter($query['filter']); |
739 | 738 | $filtermethod .= $this->dateFilter($query['filter']); |
740 | - $cfcolfilter=0; |
|
739 | + $cfcolfilter = 0; |
|
741 | 740 | if (is_array($query['col_filter'])) |
742 | 741 | { |
743 | - foreach($query['col_filter'] as $col => $data) |
|
742 | + foreach ($query['col_filter'] as $col => $data) |
|
744 | 743 | { |
745 | 744 | if (is_int($col)) |
746 | 745 | { |
747 | 746 | $filtermethod .= ' AND '.$data; |
748 | 747 | continue; |
749 | 748 | } |
750 | - if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col])) $col = 'info_'.$col; |
|
751 | - if ((string)$data !== '' && preg_match('/^[a-z_0-9]+$/i',$col)) |
|
749 | + if ($col[0] != '#' && substr($col, 0, 5) != 'info_' && isset($table_def['fd']['info_'.$col])) $col = 'info_'.$col; |
|
750 | + if ((string)$data !== '' && preg_match('/^[a-z_0-9]+$/i', $col)) |
|
752 | 751 | { |
753 | 752 | switch ($col) |
754 | 753 | { |
755 | 754 | case 'info_responsible': |
756 | - $data = (int) $data; |
|
755 | + $data = (int)$data; |
|
757 | 756 | if (!$data) continue; |
758 | 757 | $filtermethod .= ' AND ('.$this->responsible_filter($data)." OR info_responsible='0' AND ". |
759 | - $this->db->expression($this->info_table,array( |
|
760 | - 'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data,true) |
|
758 | + $this->db->expression($this->info_table, array( |
|
759 | + 'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data, true) |
|
761 | 760 | )).')'; |
762 | 761 | break; |
763 | 762 | |
764 | 763 | case 'info_id': // info_id itself is ambigous |
765 | - $filtermethod .= ' AND '.$this->db->expression($this->info_table,'main.',array('info_id' => $data)); |
|
764 | + $filtermethod .= ' AND '.$this->db->expression($this->info_table, 'main.', array('info_id' => $data)); |
|
766 | 765 | break; |
767 | 766 | |
768 | 767 | default: |
769 | - $filtermethod .= ' AND '.$this->db->expression($this->info_table,array($col => $data)); |
|
768 | + $filtermethod .= ' AND '.$this->db->expression($this->info_table, array($col => $data)); |
|
770 | 769 | break; |
771 | 770 | } |
772 | 771 | } |
773 | - if ($col[0] == '#' && $query['custom_fields'] && $data) |
|
772 | + if ($col[0] == '#' && $query['custom_fields'] && $data) |
|
774 | 773 | { |
775 | 774 | $filtermethod .= " AND main.info_id IN (SELECT DISTINCT info_id FROM $this->extra_table WHERE "; |
776 | 775 | $custom_fields = config::get_customfields('infolog'); |
777 | 776 | |
778 | - if($custom_fields[substr($col,1)]['type'] == 'select' && $custom_fields[substr($col,1)]['rows'] > 1) |
|
777 | + if ($custom_fields[substr($col, 1)]['type'] == 'select' && $custom_fields[substr($col, 1)]['rows'] > 1) |
|
779 | 778 | { |
780 | 779 | // Multi-select - any entry with the filter value selected matches |
781 | 780 | $filtermethod .= $this->db->expression($this->extra_table, array( |
782 | - 'info_extra_name' => substr($col,1), |
|
783 | - $this->db->concat("','",'info_extra_value',"','").' '.$this->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote('%,'.$data.',%'), |
|
781 | + 'info_extra_name' => substr($col, 1), |
|
782 | + $this->db->concat("','", 'info_extra_value', "','").' '.$this->db->capabilities[egw_db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote('%,'.$data.',%'), |
|
784 | 783 | )).')'; |
785 | 784 | } |
786 | 785 | else |
787 | 786 | { |
788 | - $filtermethod .= $this->db->expression($this->extra_table,array( |
|
789 | - 'info_extra_name' => substr($col,1), |
|
787 | + $filtermethod .= $this->db->expression($this->extra_table, array( |
|
788 | + 'info_extra_name' => substr($col, 1), |
|
790 | 789 | 'info_extra_value' => $data, |
791 | 790 | )).')'; |
792 | 791 | } |
@@ -798,12 +797,12 @@ discard block |
||
798 | 797 | |
799 | 798 | if ((int)$query['cat_id']) |
800 | 799 | { |
801 | - $categories = new categories('','infolog'); |
|
800 | + $categories = new categories('', 'infolog'); |
|
802 | 801 | $cats = $categories->return_all_children((int)$query['cat_id']); |
803 | - $filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']); |
|
802 | + $filtermethod .= ' AND info_cat'.(count($cats) > 1 ? ' IN ('.implode(',', $cats).') ' : '='.(int)$query['cat_id']); |
|
804 | 803 | } |
805 | 804 | $join = $distinct = ''; |
806 | - if ($query['query']) $query['search'] = $query['query']; // allow both names |
|
805 | + if ($query['query']) $query['search'] = $query['query']; // allow both names |
|
807 | 806 | if ($query['search']) // we search in _from, _subject, _des and _extra_value for $query |
808 | 807 | { |
809 | 808 | /* new code join the index |
@@ -823,7 +822,7 @@ discard block |
||
823 | 822 | ctype_digit($query['search'] ? ' UNION (SELECT '.$this->db->quote($query['search']).')' : '').')'; |
824 | 823 | */ |
825 | 824 | /* old code searching the table direct */ |
826 | - $columns = array('info_from','info_addr','info_location','info_subject','info_extra_value'); |
|
825 | + $columns = array('info_from', 'info_addr', 'info_location', 'info_subject', 'info_extra_value'); |
|
827 | 826 | // at the moment MaxDB 7.5 cant cast nor search text columns, it's suppost to change in 7.6 |
828 | 827 | if ($this->db->capabilities['like_on_text']) $columns[] = 'info_des'; |
829 | 828 | |
@@ -831,13 +830,13 @@ discard block |
||
831 | 830 | $so_sql = new so_sql('infolog', $this->info_table, $this->db); |
832 | 831 | $search = $so_sql->search2criteria($query['search'], $wildcard, $op, null, $columns); |
833 | 832 | $sql_query = 'AND ('.(is_numeric($query['search']) ? 'main.info_id='.(int)$query['search'].' OR ' : ''). |
834 | - implode($op, $search) .')'; |
|
833 | + implode($op, $search).')'; |
|
835 | 834 | |
836 | - $join = ($cfcolfilter>0 ? '':'LEFT')." JOIN $this->extra_table ON main.info_id=$this->extra_table.info_id "; |
|
835 | + $join = ($cfcolfilter > 0 ? '' : 'LEFT')." JOIN $this->extra_table ON main.info_id=$this->extra_table.info_id "; |
|
837 | 836 | // mssql and others cant use DISTICT if text columns (info_des) are involved |
838 | 837 | $distinct = $this->db->capabilities['distinct_on_text'] ? 'DISTINCT' : ''; |
839 | 838 | } |
840 | - $pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0))); |
|
839 | + $pid = 'AND '.$this->db->expression($this->info_table, array('info_id_parent' => ($action == 'sp' ? $query['action_id'] : 0))); |
|
841 | 840 | |
842 | 841 | if ($GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] != '1' && $action != 'sp' || |
843 | 842 | (string)$query['col_filter']['info_id_parent'] !== '' || |
@@ -858,14 +857,14 @@ discard block |
||
858 | 857 | } |
859 | 858 | else |
860 | 859 | { |
861 | - $query['total'] = $this->db->query($sql="SELECT $distinct main.info_id ".$sql_query,__LINE__,__FILE__)->NumRows(); |
|
860 | + $query['total'] = $this->db->query($sql = "SELECT $distinct main.info_id ".$sql_query, __LINE__, __FILE__)->NumRows(); |
|
862 | 861 | } |
863 | 862 | $info_customfield = ''; |
864 | 863 | if ($sortbycf != '') |
865 | 864 | { |
866 | 865 | $sort_col = "(SELECT DISTINCT info_extra_value FROM $this->extra_table sub2 WHERE sub2.info_id=main.info_id AND info_extra_name=".$this->db->quote($sortbycf).")"; |
867 | 866 | if (!isset($custom_fields)) $custom_fields = config::get_customfields('infolog'); |
868 | - switch($custom_fields[$sortbycf]['type']) |
|
867 | + switch ($custom_fields[$sortbycf]['type']) |
|
869 | 868 | { |
870 | 869 | case 'int': |
871 | 870 | $sort_col = $this->db->to_int($sort_col); |
@@ -884,9 +883,9 @@ discard block |
||
884 | 883 | $query['start'] = 0; |
885 | 884 | } |
886 | 885 | $cols = isset($query['cols']) ? $query['cols'] : 'main.*'; |
887 | - if (is_array($cols)) $cols = implode(',',$cols); |
|
888 | - $rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.$query['append'].' '.$ordermethod,__LINE__,__FILE__, |
|
889 | - (int) $query['start'],isset($query['start']) ? (int) $query['num_rows'] : -1,false,egw_db::FETCH_ASSOC); |
|
886 | + if (is_array($cols)) $cols = implode(',', $cols); |
|
887 | + $rs = $this->db->query($sql = 'SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.$query['append'].' '.$ordermethod, __LINE__, __FILE__, |
|
888 | + (int)$query['start'], isset($query['start']) ? (int)$query['num_rows'] : -1, false, egw_db::FETCH_ASSOC); |
|
890 | 889 | //echo "<p>db::query('$sql',,,".(int)$query['start'].','.(isset($query['start']) ? (int) $query['num_rows'] : -1).")</p>\n"; |
891 | 890 | |
892 | 891 | if ($mysql_calc_rows) |
@@ -901,9 +900,9 @@ discard block |
||
901 | 900 | { |
902 | 901 | return $rs; |
903 | 902 | } |
904 | - foreach($rs as $info) |
|
903 | + foreach ($rs as $info) |
|
905 | 904 | { |
906 | - $info['info_responsible'] = $info['info_responsible'] ? explode(',',$info['info_responsible']) : array(); |
|
905 | + $info['info_responsible'] = $info['info_responsible'] ? explode(',', $info['info_responsible']) : array(); |
|
907 | 906 | |
908 | 907 | $ids[$info['info_id']] = $info; |
909 | 908 | } |
@@ -916,19 +915,19 @@ discard block |
||
916 | 915 | } |
917 | 916 | // if no specific custom field is selected, show/query all custom fields |
918 | 917 | if ($ids && ($query['custom_fields'] || $query['csv_export'] || |
919 | - $index_load_cfs && $query['col_filter']['info_type'] && in_array($query['col_filter']['info_type'],$index_load_cfs))) |
|
918 | + $index_load_cfs && $query['col_filter']['info_type'] && in_array($query['col_filter']['info_type'], $index_load_cfs))) |
|
920 | 919 | { |
921 | 920 | $where = array('info_id' => array_keys($ids)); |
922 | - if (!($query['csv_export'] || strchr(is_array($query['selectcols']) ? implode(',',$query['selectcols']):$query['selectcols'],'#') === false || |
|
923 | - $index_load_cfs && $query['col_filter']['info_type'] && in_array($query['col_filter']['info_type'],$index_load_cfs))) |
|
921 | + if (!($query['csv_export'] || strchr(is_array($query['selectcols']) ? implode(',', $query['selectcols']) : $query['selectcols'], '#') === false || |
|
922 | + $index_load_cfs && $query['col_filter']['info_type'] && in_array($query['col_filter']['info_type'], $index_load_cfs))) |
|
924 | 923 | { |
925 | 924 | $where['info_extra_name'] = array(); |
926 | - foreach(is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols']) as $col) |
|
925 | + foreach (is_array($query['selectcols']) ? $query['selectcols'] : explode(',', $query['selectcols']) as $col) |
|
927 | 926 | { |
928 | - if ($col[0] == '#') $where['info_extra_name'][] = substr($col,1); |
|
927 | + if ($col[0] == '#') $where['info_extra_name'][] = substr($col, 1); |
|
929 | 928 | } |
930 | 929 | } |
931 | - foreach($this->db->select($this->extra_table,'*',$where,__LINE__,__FILE__) as $row) |
|
930 | + foreach ($this->db->select($this->extra_table, '*', $where, __LINE__, __FILE__) as $row) |
|
932 | 931 | { |
933 | 932 | $ids[$row['info_id']]['#'.$row['info_extra_name']] = $row['info_extra_value']; |
934 | 933 | } |
@@ -953,29 +952,29 @@ discard block |
||
953 | 952 | { |
954 | 953 | $users = array(); |
955 | 954 | |
956 | - $this->db->select($this->info_table,'DISTINCT info_owner',array( |
|
957 | - str_replace(' AND ','',$this->statusFilter('open')), |
|
958 | - '(ABS(info_startdate-'.time().')<'.(4*24*60*60).' OR '. // start_day within 4 days |
|
959 | - 'ABS(info_enddate-'.time().')<'.(4*24*60*60).')', // end_day within 4 days |
|
960 | - ),__LINE__,__FILE__); |
|
955 | + $this->db->select($this->info_table, 'DISTINCT info_owner', array( |
|
956 | + str_replace(' AND ', '', $this->statusFilter('open')), |
|
957 | + '(ABS(info_startdate-'.time().')<'.(4 * 24 * 60 * 60).' OR '.// start_day within 4 days |
|
958 | + 'ABS(info_enddate-'.time().')<'.(4 * 24 * 60 * 60).')', // end_day within 4 days |
|
959 | + ), __LINE__, __FILE__); |
|
961 | 960 | while ($this->db->next_record()) |
962 | 961 | { |
963 | 962 | $users[] = $this->db->f(0); |
964 | 963 | } |
965 | - $this->db->select($this->info_table,'DISTINCT info_responsible',$this->statusFilter('open',false),__LINE__,__FILE__); |
|
964 | + $this->db->select($this->info_table, 'DISTINCT info_responsible', $this->statusFilter('open', false), __LINE__, __FILE__); |
|
966 | 965 | while ($this->db->next_record()) |
967 | 966 | { |
968 | - foreach(explode(',',$this->db->f(0)) as $responsible) |
|
967 | + foreach (explode(',', $this->db->f(0)) as $responsible) |
|
969 | 968 | { |
970 | 969 | if ($GLOBALS['egw']->accounts->get_type($responsible) == 'g') |
971 | 970 | { |
972 | - $responsible = $GLOBALS['egw']->accounts->members($responsible,true); |
|
971 | + $responsible = $GLOBALS['egw']->accounts->members($responsible, true); |
|
973 | 972 | } |
974 | 973 | if ($responsible) |
975 | 974 | { |
976 | - foreach(is_array($responsible) ? $responsible : array($responsible) as $user) |
|
975 | + foreach (is_array($responsible) ? $responsible : array($responsible) as $user) |
|
977 | 976 | { |
978 | - if ($user && !in_array($user,$users)) $users[] = $user; |
|
977 | + if ($user && !in_array($user, $users)) $users[] = $user; |
|
979 | 978 | } |
980 | 979 | } |
981 | 980 | } |
@@ -85,10 +85,16 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function is_responsible($info,$user=null) |
87 | 87 | { |
88 | - if (!$user) $user = $this->user; |
|
88 | + if (!$user) |
|
89 | + { |
|
90 | + $user = $this->user; |
|
91 | + } |
|
89 | 92 | |
90 | 93 | static $um_cache = array(); |
91 | - if ($user == $this->user) $user_and_memberships =& $um_cache[$user]; |
|
94 | + if ($user == $this->user) |
|
95 | + { |
|
96 | + $user_and_memberships =& $um_cache[$user]; |
|
97 | + } |
|
92 | 98 | if (!isset($user_and_memberships)) |
93 | 99 | { |
94 | 100 | $user_and_memberships = $GLOBALS['egw']->accounts->memberships($user,true); |
@@ -109,20 +115,32 @@ discard block |
||
109 | 115 | */ |
110 | 116 | function check_access( $info,$required_rights,$implicit_edit=false,array $grants=null,$user=null ) |
111 | 117 | { |
112 | - if (is_null($grants)) $grants = $this->grants; |
|
113 | - if (!$user) $user = $this->user; |
|
118 | + if (is_null($grants)) |
|
119 | + { |
|
120 | + $grants = $this->grants; |
|
121 | + } |
|
122 | + if (!$user) |
|
123 | + { |
|
124 | + $user = $this->user; |
|
125 | + } |
|
114 | 126 | |
115 | 127 | // if info-array, but no owner given, force reading of info from db |
116 | - if (is_array($info) && !$info['info_owner']) $info = $info['info_id']; |
|
128 | + if (is_array($info) && !$info['info_owner']) |
|
129 | + { |
|
130 | + $info = $info['info_id']; |
|
131 | + } |
|
117 | 132 | |
118 | 133 | if (is_array($info)) |
119 | 134 | { |
120 | 135 | |
121 | 136 | } |
122 | - elseif ((int) $info != $this->data['info_id']) // already loaded? |
|
137 | + elseif ((int) $info != $this->data['info_id']) |
|
138 | + { |
|
139 | + // already loaded? |
|
123 | 140 | { |
124 | 141 | // dont change our own internal data, |
125 | 142 | $backup_data = $this->data; |
143 | + } |
|
126 | 144 | $info = $this->read(array('info_id'=>$info)); |
127 | 145 | $this->data = $backup_data; |
128 | 146 | } |
@@ -156,7 +174,10 @@ discard block |
||
156 | 174 | */ |
157 | 175 | function responsible_filter($users) |
158 | 176 | { |
159 | - if (!$users) return '0'; |
|
177 | + if (!$users) |
|
178 | + { |
|
179 | + return '0'; |
|
180 | + } |
|
160 | 181 | |
161 | 182 | $responsible = array(); |
162 | 183 | foreach((array)$users as $user) |
@@ -246,11 +267,14 @@ discard block |
||
246 | 267 | " OR info_status = 'offer' AND $public_access" : '').")". |
247 | 268 | " AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')'; |
248 | 269 | } |
249 | - elseif ($filter != 'my' && $filter != 'responsible') // none --> all entrys user has rights to see |
|
270 | + elseif ($filter != 'my' && $filter != 'responsible') |
|
271 | + { |
|
272 | + // none --> all entrys user has rights to see |
|
250 | 273 | { |
251 | 274 | if ($has_private_access) |
252 | 275 | { |
253 | 276 | $filtermethod .= " OR $has_private_access"; |
277 | + } |
|
254 | 278 | } |
255 | 279 | if (count($public_user_list)) |
256 | 280 | { |
@@ -496,7 +520,10 @@ discard block |
||
496 | 520 | { |
497 | 521 | $new_responsible = explode(',',$row['info_responsible']); |
498 | 522 | unset($new_responsible[array_search($args['account_id'],$new_responsible)]); |
499 | - if ((int)$args['new_owner']) $new_responsible[] = (int)$args['new_owner']; |
|
523 | + if ((int)$args['new_owner']) |
|
524 | + { |
|
525 | + $new_responsible[] = (int)$args['new_owner']; |
|
526 | + } |
|
500 | 527 | $this->db->update($this->info_table,array( |
501 | 528 | 'info_responsible' => implode(',',$new_responsible), |
502 | 529 | ),array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog'); |
@@ -526,10 +553,13 @@ discard block |
||
526 | 553 | //echo "soinfolog::write(,$check_modified) values="; _debug_array($values); |
527 | 554 | $info_id = (int) $values['info_id']; |
528 | 555 | |
529 | - if (array_key_exists('info_responsible',$values)) // isset($values['info_responsible']) returns false for NULL! |
|
556 | + if (array_key_exists('info_responsible',$values)) |
|
557 | + { |
|
558 | + // isset($values['info_responsible']) returns false for NULL! |
|
530 | 559 | { |
531 | 560 | $values['info_responsible'] = $values['info_responsible'] ? implode(',',$values['info_responsible']) : '0'; |
532 | 561 | } |
562 | + } |
|
533 | 563 | $table_def = $this->db->get_table_definitions('infolog',$this->info_table); |
534 | 564 | $to_write = array(); |
535 | 565 | foreach($values as $key => $val) |
@@ -540,12 +570,18 @@ discard block |
||
540 | 570 | } |
541 | 571 | } |
542 | 572 | // writing no price as SQL NULL (required by postgres) |
543 | - if ($to_write['info_price'] === '') $to_write['info_price'] = NULL; |
|
573 | + if ($to_write['info_price'] === '') |
|
574 | + { |
|
575 | + $to_write['info_price'] = NULL; |
|
576 | + } |
|
544 | 577 | |
545 | 578 | if (($this->data['info_id'] = $info_id)) |
546 | 579 | { |
547 | 580 | $where = array('info_id' => $info_id); |
548 | - if ($check_modified) $where['info_datemodified'] = $check_modified; |
|
581 | + if ($check_modified) |
|
582 | + { |
|
583 | + $where['info_datemodified'] = $check_modified; |
|
584 | + } |
|
549 | 585 | if (!$this->db->update($this->info_table,$to_write,$where,__LINE__,__FILE__)) |
550 | 586 | { |
551 | 587 | //error_log("### soinfolog::write(".print_r($to_write,true).") where=".print_r($where,true)." returning false"); |
@@ -559,7 +595,11 @@ discard block |
||
559 | 595 | } |
560 | 596 | else |
561 | 597 | { |
562 | - if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0; // must not be null |
|
598 | + if (!isset($to_write['info_id_parent'])) |
|
599 | + { |
|
600 | + $to_write['info_id_parent'] = 0; |
|
601 | + } |
|
602 | + // must not be null |
|
563 | 603 | |
564 | 604 | $this->db->insert($this->info_table,$to_write,false,__LINE__,__FILE__); |
565 | 605 | $info_id = $this->data['info_id'] = $this->db->get_last_insert_id($this->info_table,'info_id'); |
@@ -588,7 +628,10 @@ discard block |
||
588 | 628 | if ($purge_cfs) |
589 | 629 | { |
590 | 630 | $where = array('info_id' => $info_id); |
591 | - if ($purge_cfs == 'ical') $where[] = "info_extra_name LIKE '#%'"; |
|
631 | + if ($purge_cfs == 'ical') |
|
632 | + { |
|
633 | + $where[] = "info_extra_name LIKE '#%'"; |
|
634 | + } |
|
592 | 635 | $this->db->delete($this->extra_table,$where,__LINE__,__FILE__); |
593 | 636 | } |
594 | 637 | $to_delete = array(); |
@@ -644,7 +687,10 @@ discard block |
||
644 | 687 | { |
645 | 688 | if (!is_array($info_id) || !$info_id) |
646 | 689 | { |
647 | - if ((int)$info_id <= 0) return 0; |
|
690 | + if ((int)$info_id <= 0) |
|
691 | + { |
|
692 | + return 0; |
|
693 | + } |
|
648 | 694 | } |
649 | 695 | $counts = array(); |
650 | 696 | foreach($this->db->select($this->info_table,'info_id_parent,COUNT(*) AS info_anz_subs',array( |
@@ -717,11 +763,20 @@ discard block |
||
717 | 763 | else |
718 | 764 | { |
719 | 765 | static $table_def = null; |
720 | - if (is_null($table_def)) $table_def = $this->db->get_table_definitions('infolog',$this->info_table); |
|
721 | - if (substr($val,0,5) != 'info_' && isset($table_def['fd']['info_'.$val])) $val = 'info_'.$val; |
|
766 | + if (is_null($table_def)) |
|
767 | + { |
|
768 | + $table_def = $this->db->get_table_definitions('infolog',$this->info_table); |
|
769 | + } |
|
770 | + if (substr($val,0,5) != 'info_' && isset($table_def['fd']['info_'.$val])) |
|
771 | + { |
|
772 | + $val = 'info_'.$val; |
|
773 | + } |
|
722 | 774 | if ($val == 'info_des' && $this->db->capabilities['order_on_text'] !== true) |
723 | 775 | { |
724 | - if (!$this->db->capabilities['order_on_text']) continue; |
|
776 | + if (!$this->db->capabilities['order_on_text']) |
|
777 | + { |
|
778 | + continue; |
|
779 | + } |
|
725 | 780 | |
726 | 781 | $val = sprintf($this->db->capabilities['order_on_text'],$val); |
727 | 782 | } |
@@ -735,7 +790,10 @@ discard block |
||
735 | 790 | $ordermethod = 'ORDER BY info_datemodified DESC'; // newest first |
736 | 791 | } |
737 | 792 | $filtermethod = $this->aclFilter($query['filter']); |
738 | - if (!$query['col_filter']['info_status']) $filtermethod .= $this->statusFilter($query['filter']); |
|
793 | + if (!$query['col_filter']['info_status']) |
|
794 | + { |
|
795 | + $filtermethod .= $this->statusFilter($query['filter']); |
|
796 | + } |
|
739 | 797 | $filtermethod .= $this->dateFilter($query['filter']); |
740 | 798 | $cfcolfilter=0; |
741 | 799 | if (is_array($query['col_filter'])) |
@@ -747,14 +805,20 @@ discard block |
||
747 | 805 | $filtermethod .= ' AND '.$data; |
748 | 806 | continue; |
749 | 807 | } |
750 | - if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col])) $col = 'info_'.$col; |
|
808 | + if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col])) |
|
809 | + { |
|
810 | + $col = 'info_'.$col; |
|
811 | + } |
|
751 | 812 | if ((string)$data !== '' && preg_match('/^[a-z_0-9]+$/i',$col)) |
752 | 813 | { |
753 | 814 | switch ($col) |
754 | 815 | { |
755 | 816 | case 'info_responsible': |
756 | 817 | $data = (int) $data; |
757 | - if (!$data) continue; |
|
818 | + if (!$data) |
|
819 | + { |
|
820 | + continue; |
|
821 | + } |
|
758 | 822 | $filtermethod .= ' AND ('.$this->responsible_filter($data)." OR info_responsible='0' AND ". |
759 | 823 | $this->db->expression($this->info_table,array( |
760 | 824 | 'info_owner' => $data > 0 ? $data : $GLOBALS['egw']->accounts->members($data,true) |
@@ -803,8 +867,14 @@ discard block |
||
803 | 867 | $filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']); |
804 | 868 | } |
805 | 869 | $join = $distinct = ''; |
806 | - if ($query['query']) $query['search'] = $query['query']; // allow both names |
|
807 | - if ($query['search']) // we search in _from, _subject, _des and _extra_value for $query |
|
870 | + if ($query['query']) |
|
871 | + { |
|
872 | + $query['search'] = $query['query']; |
|
873 | + } |
|
874 | + // allow both names |
|
875 | + if ($query['search']) |
|
876 | + { |
|
877 | + // we search in _from, _subject, _des and _extra_value for $query |
|
808 | 878 | { |
809 | 879 | /* new code join the index |
810 | 880 | if (ctype_digit($query['search'])) // search by ticket-number (numbers get never indexed!) |
@@ -824,8 +894,12 @@ discard block |
||
824 | 894 | */ |
825 | 895 | /* old code searching the table direct */ |
826 | 896 | $columns = array('info_from','info_addr','info_location','info_subject','info_extra_value'); |
897 | + } |
|
827 | 898 | // at the moment MaxDB 7.5 cant cast nor search text columns, it's suppost to change in 7.6 |
828 | - if ($this->db->capabilities['like_on_text']) $columns[] = 'info_des'; |
|
899 | + if ($this->db->capabilities['like_on_text']) |
|
900 | + { |
|
901 | + $columns[] = 'info_des'; |
|
902 | + } |
|
829 | 903 | |
830 | 904 | $wildcard = $op = null; |
831 | 905 | $so_sql = new so_sql('infolog', $this->info_table, $this->db); |
@@ -864,7 +938,10 @@ discard block |
||
864 | 938 | if ($sortbycf != '') |
865 | 939 | { |
866 | 940 | $sort_col = "(SELECT DISTINCT info_extra_value FROM $this->extra_table sub2 WHERE sub2.info_id=main.info_id AND info_extra_name=".$this->db->quote($sortbycf).")"; |
867 | - if (!isset($custom_fields)) $custom_fields = config::get_customfields('infolog'); |
|
941 | + if (!isset($custom_fields)) |
|
942 | + { |
|
943 | + $custom_fields = config::get_customfields('infolog'); |
|
944 | + } |
|
868 | 945 | switch($custom_fields[$sortbycf]['type']) |
869 | 946 | { |
870 | 947 | case 'int': |
@@ -884,7 +961,10 @@ discard block |
||
884 | 961 | $query['start'] = 0; |
885 | 962 | } |
886 | 963 | $cols = isset($query['cols']) ? $query['cols'] : 'main.*'; |
887 | - if (is_array($cols)) $cols = implode(',',$cols); |
|
964 | + if (is_array($cols)) |
|
965 | + { |
|
966 | + $cols = implode(',',$cols); |
|
967 | + } |
|
888 | 968 | $rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query.$query['append'].' '.$ordermethod,__LINE__,__FILE__, |
889 | 969 | (int) $query['start'],isset($query['start']) ? (int) $query['num_rows'] : -1,false,egw_db::FETCH_ASSOC); |
890 | 970 | //echo "<p>db::query('$sql',,,".(int)$query['start'].','.(isset($query['start']) ? (int) $query['num_rows'] : -1).")</p>\n"; |
@@ -912,7 +992,10 @@ discard block |
||
912 | 992 | { |
913 | 993 | $config_data = config::read('infolog'); |
914 | 994 | $index_load_cfs = $config_data['index_load_cfs']; |
915 | - if (!is_array($index_load_cfs)) $index_load_cfs = explode(',', $index_load_cfs); |
|
995 | + if (!is_array($index_load_cfs)) |
|
996 | + { |
|
997 | + $index_load_cfs = explode(',', $index_load_cfs); |
|
998 | + } |
|
916 | 999 | } |
917 | 1000 | // if no specific custom field is selected, show/query all custom fields |
918 | 1001 | if ($ids && ($query['custom_fields'] || $query['csv_export'] || |
@@ -925,7 +1008,10 @@ discard block |
||
925 | 1008 | $where['info_extra_name'] = array(); |
926 | 1009 | foreach(is_array($query['selectcols']) ? $query['selectcols'] : explode(',',$query['selectcols']) as $col) |
927 | 1010 | { |
928 | - if ($col[0] == '#') $where['info_extra_name'][] = substr($col,1); |
|
1011 | + if ($col[0] == '#') |
|
1012 | + { |
|
1013 | + $where['info_extra_name'][] = substr($col,1); |
|
1014 | + } |
|
929 | 1015 | } |
930 | 1016 | } |
931 | 1017 | foreach($this->db->select($this->extra_table,'*',$where,__LINE__,__FILE__) as $row) |
@@ -975,7 +1061,10 @@ discard block |
||
975 | 1061 | { |
976 | 1062 | foreach(is_array($responsible) ? $responsible : array($responsible) as $user) |
977 | 1063 | { |
978 | - if ($user && !in_array($user,$users)) $users[] = $user; |
|
1064 | + if ($user && !in_array($user,$users)) |
|
1065 | + { |
|
1066 | + $users[] = $user; |
|
1067 | + } |
|
979 | 1068 | } |
980 | 1069 | } |
981 | 1070 | } |