@@ -71,7 +71,10 @@ discard block |
||
71 | 71 | ); |
72 | 72 | |
73 | 73 | $requestedpermissionsarray = array(); |
74 | -if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
74 | +if (GETPOST('state')) { |
|
75 | + $requestedpermissionsarray = explode(',', GETPOST('state')); |
|
76 | +} |
|
77 | +// Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back |
|
75 | 78 | /*if ($action != 'delete' && empty($requestedpermissionsarray)) |
76 | 79 | { |
77 | 80 | print 'Error, parameter state is not defined'; |
@@ -107,12 +110,14 @@ discard block |
||
107 | 110 | exit(); |
108 | 111 | } |
109 | 112 | |
110 | -if (!empty($_GET['code'])) // We are coming from oauth provider page |
|
113 | +if (!empty($_GET['code'])) { |
|
114 | + // We are coming from oauth provider page |
|
111 | 115 | { |
112 | 116 | // We should have |
113 | 117 | //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) |
114 | 118 | |
115 | 119 | dol_syslog("We are coming from the oauth provider page"); |
120 | +} |
|
116 | 121 | //llxHeader('',$langs->trans("OAuthSetup")); |
117 | 122 | |
118 | 123 | //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; |
@@ -127,8 +127,11 @@ discard block |
||
127 | 127 | if ($resql) |
128 | 128 | { |
129 | 129 | $obj = $db->fetch_object($resql); |
130 | - if ($obj) $max = intval($obj->max); |
|
131 | - else $max = 0; |
|
130 | + if ($obj) { |
|
131 | + $max = intval($obj->max); |
|
132 | + } else { |
|
133 | + $max = 0; |
|
134 | + } |
|
132 | 135 | } else { |
133 | 136 | dol_syslog("mod_mo_standard::getNextValue", LOG_DEBUG); |
134 | 137 | return -1; |
@@ -138,8 +141,13 @@ discard block |
||
138 | 141 | $date = $object->date_creation; |
139 | 142 | $yymm = strftime("%y%m", $date); |
140 | 143 | |
141 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
142 | - else $num = sprintf("%04s", $max + 1); |
|
144 | + if ($max >= (pow(10, 4) - 1)) { |
|
145 | + $num = $max + 1; |
|
146 | + } |
|
147 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
148 | + else { |
|
149 | + $num = sprintf("%04s", $max + 1); |
|
150 | + } |
|
143 | 151 | |
144 | 152 | dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num); |
145 | 153 | return $this->prefix.$yymm."-".$num; |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $this->db = $db; |
70 | 70 | |
71 | 71 | $this->separator = ','; |
72 | - if (!empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) $this->separator = $conf->global->EXPORT_CSV_SEPARATOR_TO_USE; |
|
72 | + if (!empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE)) { |
|
73 | + $this->separator = $conf->global->EXPORT_CSV_SEPARATOR_TO_USE; |
|
74 | + } |
|
73 | 75 | $this->escape = '"'; |
74 | 76 | $this->enclosure = '"'; |
75 | 77 | |
@@ -261,15 +263,22 @@ discard block |
||
261 | 263 | |
262 | 264 | foreach ($array_selected_sorted as $code => $value) |
263 | 265 | { |
264 | - if (strpos($code, ' as ') == 0) $alias = str_replace(array('.', '-', '(', ')'), '_', $code); |
|
265 | - else $alias = substr($code, strpos($code, ' as ') + 4); |
|
266 | - if (empty($alias)) dol_print_error('', 'Bad value for field with key='.$code.'. Try to redefine export.'); |
|
266 | + if (strpos($code, ' as ') == 0) { |
|
267 | + $alias = str_replace(array('.', '-', '(', ')'), '_', $code); |
|
268 | + } else { |
|
269 | + $alias = substr($code, strpos($code, ' as ') + 4); |
|
270 | + } |
|
271 | + if (empty($alias)) { |
|
272 | + dol_print_error('', 'Bad value for field with key='.$code.'. Try to redefine export.'); |
|
273 | + } |
|
267 | 274 | |
268 | 275 | $newvalue = $outputlangs->convToOutputCharset($objp->$alias); // objp->$alias must be utf8 encoded as any var in memory // newvalue is now $outputlangs->charset_output encoded |
269 | 276 | $typefield = isset($array_types[$code]) ? $array_types[$code] : ''; |
270 | 277 | |
271 | 278 | // Translation newvalue |
272 | - if (preg_match('/^\((.*)\)$/i', $newvalue, $reg)) $newvalue = $outputlangs->transnoentities($reg[1]); |
|
279 | + if (preg_match('/^\((.*)\)$/i', $newvalue, $reg)) { |
|
280 | + $newvalue = $outputlangs->transnoentities($reg[1]); |
|
281 | + } |
|
273 | 282 | |
274 | 283 | $newvalue = $this->csvClean($newvalue, $outputlangs->charset_output); |
275 | 284 |
@@ -131,8 +131,11 @@ discard block |
||
131 | 131 | if ($resql) |
132 | 132 | { |
133 | 133 | $obj = $db->fetch_object($resql); |
134 | - if ($obj) $max = intval($obj->max); |
|
135 | - else $max = 0; |
|
134 | + if ($obj) { |
|
135 | + $max = intval($obj->max); |
|
136 | + } else { |
|
137 | + $max = 0; |
|
138 | + } |
|
136 | 139 | } else { |
137 | 140 | dol_syslog("mod_expedition_safor::getNextValue", LOG_DEBUG); |
138 | 141 | return -1; |
@@ -141,8 +144,13 @@ discard block |
||
141 | 144 | $date = time(); |
142 | 145 | $yymm = strftime("%y%m", $date); |
143 | 146 | |
144 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
145 | - else $num = sprintf("%04s", $max + 1); |
|
147 | + if ($max >= (pow(10, 4) - 1)) { |
|
148 | + $num = $max + 1; |
|
149 | + } |
|
150 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
151 | + else { |
|
152 | + $num = sprintf("%04s", $max + 1); |
|
153 | + } |
|
146 | 154 | |
147 | 155 | dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num); |
148 | 156 | return $this->prefix.$yymm."-".$num; |
@@ -64,7 +64,10 @@ discard block |
||
64 | 64 | { |
65 | 65 | global $conf; |
66 | 66 | |
67 | - if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) $this->prefix = 'PO'; // We use correct standard code "PO = Purchase Order" |
|
67 | + if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 5.0) { |
|
68 | + $this->prefix = 'PO'; |
|
69 | + } |
|
70 | + // We use correct standard code "PO = Purchase Order" |
|
68 | 71 | } |
69 | 72 | |
70 | 73 | /** |
@@ -145,17 +148,28 @@ discard block |
||
145 | 148 | if ($resql) |
146 | 149 | { |
147 | 150 | $obj = $db->fetch_object($resql); |
148 | - if ($obj) $max = intval($obj->max); |
|
149 | - else $max = 0; |
|
151 | + if ($obj) { |
|
152 | + $max = intval($obj->max); |
|
153 | + } else { |
|
154 | + $max = 0; |
|
155 | + } |
|
150 | 156 | } |
151 | 157 | |
152 | 158 | //$date=time(); |
153 | 159 | $date = $object->date_commande; // Not always defined |
154 | - if (empty($date)) $date = $object->date; // Creation date is order date for suppliers orders |
|
160 | + if (empty($date)) { |
|
161 | + $date = $object->date; |
|
162 | + } |
|
163 | + // Creation date is order date for suppliers orders |
|
155 | 164 | $yymm = strftime("%y%m", $date); |
156 | 165 | |
157 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
158 | - else $num = sprintf("%04s", $max + 1); |
|
166 | + if ($max >= (pow(10, 4) - 1)) { |
|
167 | + $num = $max + 1; |
|
168 | + } |
|
169 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
170 | + else { |
|
171 | + $num = sprintf("%04s", $max + 1); |
|
172 | + } |
|
159 | 173 | |
160 | 174 | return $this->prefix.$yymm."-".$num; |
161 | 175 | } |
@@ -137,8 +137,11 @@ discard block |
||
137 | 137 | if ($resql) |
138 | 138 | { |
139 | 139 | $obj = $db->fetch_object($resql); |
140 | - if ($obj) $max = intval($obj->max); |
|
141 | - else $max = 0; |
|
140 | + if ($obj) { |
|
141 | + $max = intval($obj->max); |
|
142 | + } else { |
|
143 | + $max = 0; |
|
144 | + } |
|
142 | 145 | } else { |
143 | 146 | dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); |
144 | 147 | return -1; |
@@ -147,8 +150,13 @@ discard block |
||
147 | 150 | $date = $holiday->date_debut; |
148 | 151 | $yymm = strftime("%y%m", $date); |
149 | 152 | |
150 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
151 | - else $num = sprintf("%04s", $max + 1); |
|
153 | + if ($max >= (pow(10, 4) - 1)) { |
|
154 | + $num = $max + 1; |
|
155 | + } |
|
156 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
157 | + else { |
|
158 | + $num = sprintf("%04s", $max + 1); |
|
159 | + } |
|
152 | 160 | |
153 | 161 | dol_syslog("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num); |
154 | 162 | return $this->prefix.$yymm."-".$num; |
@@ -250,10 +250,16 @@ discard block |
||
250 | 250 | { |
251 | 251 | $num = $this->db->num_rows($resql); |
252 | 252 | |
253 | - if (empty($conf->categorie->enabled)) $num = 0; // Force empty list if category module is not enabled |
|
253 | + if (empty($conf->categorie->enabled)) { |
|
254 | + $num = 0; |
|
255 | + } |
|
256 | + // Force empty list if category module is not enabled |
|
254 | 257 | |
255 | - if ($num) $s .= '<option value="0"> </option>'; |
|
256 | - else $s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>'; |
|
258 | + if ($num) { |
|
259 | + $s .= '<option value="0"> </option>'; |
|
260 | + } else { |
|
261 | + $s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>'; |
|
262 | + } |
|
257 | 263 | |
258 | 264 | $i = 0; |
259 | 265 | while ($i < $num) |
@@ -261,10 +267,16 @@ discard block |
||
261 | 267 | $obj = $this->db->fetch_object($resql); |
262 | 268 | |
263 | 269 | $type = ''; |
264 | - if ($obj->type == 1) $type = $langs->trans("Supplier"); |
|
265 | - if ($obj->type == 2) $type = $langs->trans("Customer"); |
|
270 | + if ($obj->type == 1) { |
|
271 | + $type = $langs->trans("Supplier"); |
|
272 | + } |
|
273 | + if ($obj->type == 2) { |
|
274 | + $type = $langs->trans("Customer"); |
|
275 | + } |
|
266 | 276 | $s .= '<option value="'.$obj->rowid.'">'.dol_trunc($obj->label, 38, 'middle'); |
267 | - if ($type) $s .= ' ('.$type.')'; |
|
277 | + if ($type) { |
|
278 | + $s .= ' ('.$type.')'; |
|
279 | + } |
|
268 | 280 | $s .= '</option>'; |
269 | 281 | $i++; |
270 | 282 | } |
@@ -124,8 +124,11 @@ discard block |
||
124 | 124 | if ($resql) |
125 | 125 | { |
126 | 126 | $obj = $db->fetch_object($resql); |
127 | - if ($obj) $max = intval($obj->max); |
|
128 | - else $max = 0; |
|
127 | + if ($obj) { |
|
128 | + $max = intval($obj->max); |
|
129 | + } else { |
|
130 | + $max = 0; |
|
131 | + } |
|
129 | 132 | } else { |
130 | 133 | dol_syslog(__METHOD__, LOG_DEBUG); |
131 | 134 | return -1; |
@@ -135,8 +138,13 @@ discard block |
||
135 | 138 | $date = $object->date_bordereau; |
136 | 139 | $yymm = strftime("%y%m", $date); |
137 | 140 | |
138 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
139 | - else $num = sprintf("%04s", $max + 1); |
|
141 | + if ($max >= (pow(10, 4) - 1)) { |
|
142 | + $num = $max + 1; |
|
143 | + } |
|
144 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
145 | + else { |
|
146 | + $num = sprintf("%04s", $max + 1); |
|
147 | + } |
|
140 | 148 | |
141 | 149 | dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
142 | 150 | return $this->prefix.$yymm."-".$num; |
@@ -92,10 +92,18 @@ |
||
92 | 92 | global $langs; |
93 | 93 | $langs->load("admin"); |
94 | 94 | |
95 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
96 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
97 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
98 | - if ($this->version) return $this->version; |
|
95 | + if ($this->version == 'development') { |
|
96 | + return $langs->trans("VersionDevelopment"); |
|
97 | + } |
|
98 | + if ($this->version == 'experimental') { |
|
99 | + return $langs->trans("VersionExperimental"); |
|
100 | + } |
|
101 | + if ($this->version == 'dolibarr') { |
|
102 | + return DOL_VERSION; |
|
103 | + } |
|
104 | + if ($this->version) { |
|
105 | + return $this->version; |
|
106 | + } |
|
99 | 107 | return $langs->trans("NotAvailable"); |
100 | 108 | } |
101 | 109 | } |