@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | $startdate = $enddate = ''; |
67 | 67 | if (GETPOST('startdatemonth')) { |
68 | - $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); |
|
68 | + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); |
|
69 | 69 | } |
70 | 70 | if (GETPOST('enddatemonth')) { |
71 | 71 | $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler |
41 | 41 | //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
42 | 42 | //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification |
43 | -if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions |
|
43 | +if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions |
|
44 | 44 | |
45 | 45 | |
46 | 46 | $sapi_type = php_sapi_name(); |
@@ -40,7 +40,10 @@ |
||
40 | 40 | //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler |
41 | 41 | //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
42 | 42 | //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification |
43 | -if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions |
|
43 | +if (!defined('NOSESSION')) { |
|
44 | + define('NOSESSION', '1'); |
|
45 | +} |
|
46 | +// On CLI mode, no need to use web sessions |
|
44 | 47 | |
45 | 48 | |
46 | 49 | $sapi_type = php_sapi_name(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $maxfilesizearray = getMaxFileSizeArray(); |
188 | 188 | $maxmin = $maxfilesizearray['maxmin']; |
189 | 189 | if ($maxmin > 0) { |
190 | - $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
190 | + $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
191 | 191 | } |
192 | 192 | $texte .= ' <input type="file" name="uploadfile">'; |
193 | 193 | $texte .= '<input type="hidden" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">'; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); |
283 | 283 | $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); |
284 | 284 | |
285 | - $newfiletmp = $objectref . '_' . $newfiletmp; |
|
285 | + $newfiletmp = $objectref.'_'.$newfiletmp; |
|
286 | 286 | //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; |
287 | 287 | |
288 | 288 | // Get extension (ods or odt) |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | if ($format == '1') { |
293 | 293 | $format = '%Y%m%d%H%M%S'; |
294 | 294 | } |
295 | - $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat; |
|
295 | + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; |
|
296 | 296 | } else { |
297 | - $filename = $newfiletmp . '.' . $newfileformat; |
|
297 | + $filename = $newfiletmp.'.'.$newfileformat; |
|
298 | 298 | } |
299 | - $file = $dir . '/' . $filename; |
|
299 | + $file = $dir.'/'.$filename; |
|
300 | 300 | //print "newdir=".$dir; |
301 | 301 | //print "newfile=".$newfile; |
302 | 302 | //print "file=".$file; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | dol_mkdir($conf->mymodule->dir_temp); |
306 | 306 | if (!is_writable($conf->mymodule->dir_temp)) { |
307 | 307 | $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->mymodule->dir_temp); |
308 | - dol_syslog('Error in write_file: ' . $this->error, LOG_ERR); |
|
308 | + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); |
|
309 | 309 | return -1; |
310 | 310 | } |
311 | 311 |
@@ -149,7 +149,9 @@ |
||
149 | 149 | if (!isModEnabled("mymodule")) { |
150 | 150 | accessforbidden(); |
151 | 151 | } |
152 | -if (!$permissiontoread) accessforbidden(); |
|
152 | +if (!$permissiontoread) { |
|
153 | + accessforbidden(); |
|
154 | +} |
|
153 | 155 | |
154 | 156 | |
155 | 157 | /* |
@@ -192,7 +192,9 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // Security check (enable the most restrictive one) |
195 | -if ($user->socid > 0) accessforbidden(); |
|
195 | +if ($user->socid > 0) { |
|
196 | + accessforbidden(); |
|
197 | +} |
|
196 | 198 | //if ($user->socid > 0) accessforbidden(); |
197 | 199 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
198 | 200 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
@@ -200,7 +202,9 @@ discard block |
||
200 | 202 | if (!isModEnabled("mymodule")) { |
201 | 203 | accessforbidden('Module mymodule not enabled'); |
202 | 204 | } |
203 | -if (!$permissiontoread) accessforbidden(); |
|
205 | +if (!$permissiontoread) { |
|
206 | + accessforbidden(); |
|
207 | +} |
|
204 | 208 | |
205 | 209 | |
206 | 210 | /* |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $object = new MyObject($db); |
119 | 119 | $extrafields = new ExtraFields($db); |
120 | 120 | $diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; |
121 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
121 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes |
|
122 | 122 | |
123 | 123 | // Fetch optionals attributes and labels |
124 | 124 | $extrafields->fetch_name_optionals_label($object->table_element); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | // Default sort order (if not yet defined by previous GETPOST) |
130 | 130 | if (!$sortfield) { |
131 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
131 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
132 | 132 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
133 | 133 | } |
134 | 134 | if (!$sortorder) { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | // Output page |
423 | 423 | // -------------------------------------------------------------------- |
424 | 424 | |
425 | -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
425 | +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
426 | 426 | |
427 | 427 | // Example : Adding jquery code |
428 | 428 | // print '<script type="text/javascript"> |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
647 | 647 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
648 | 648 | } |
649 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
649 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
650 | 650 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
651 | 651 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
652 | 652 | $totalarray['nbfield']++; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
47 | 47 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
48 | 48 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
49 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
49 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
50 | 50 | $confirm = GETPOST('confirm', 'alpha'); |
51 | 51 | |
52 | 52 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | foreach ($typeleaves as $key => $val) { |
255 | 255 | $labeltypes[$val['id']] = ($langs->trans($val['code']) != $val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']); |
256 | 256 | } |
257 | - $formquestion [] = array( 'type' => 'other', |
|
257 | + $formquestion [] = array('type' => 'other', |
|
258 | 258 | 'name' => 'typeofholiday', |
259 | 259 | 'label' => $langs->trans("Type"), |
260 | 260 | 'value' => $form->selectarray('typeholiday', $labeltypes, GETPOST('typeholiday', 'alpha'), 1) |
261 | 261 | ); |
262 | - $formquestion [] = array( 'type' => 'other', |
|
262 | + $formquestion [] = array('type' => 'other', |
|
263 | 263 | 'name' => 'nbdaysholydays', |
264 | 264 | 'label' => $langs->trans("NumberDayAddMass"), |
265 | 265 | 'value' => '<input name="nbdaysholidays" class="maxwidth75" id="nbdaysholidays" value="'.GETPOST('nbdaysholidays', 'int').'">' |
@@ -201,7 +201,7 @@ |
||
201 | 201 | $tmplotstatic->eatby = $objp->eatby; |
202 | 202 | |
203 | 203 | print '<tr class="oddeven">'; |
204 | - print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; |
|
204 | + print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>'; |
|
205 | 205 | print '<td class="tdoverflowmax150">'; |
206 | 206 | print $producttmp->getNomUrl(1); |
207 | 207 | print "</td>\n"; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $fk_entrepot = GETPOST('fk_entrepot', 'int'); |
69 | 69 | |
70 | 70 | // List all visible warehouses |
71 | -$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); |
|
71 | +$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")"); |
|
72 | 72 | $listofqualifiedwarehousesid = ""; |
73 | 73 | $count = 0; |
74 | 74 | while ($tmpobj = $db->fetch_object($resWar)) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; |
362 | 362 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; |
363 | 363 | $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid); |
364 | -$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse) .')'; |
|
364 | +$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse).')'; |
|
365 | 365 | |
366 | 366 | //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; |
367 | 367 | if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | exit; |
801 | 801 | } |
802 | 802 | |
803 | - $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock?', novirtual':''), $draftchecked); |
|
803 | + $prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked); |
|
804 | 804 | |
805 | 805 | // Multilangs |
806 | 806 | if (getDolGlobalInt('MAIN_MULTILANGS')) { |
@@ -672,8 +672,12 @@ discard block |
||
672 | 672 | if ($limit > 0 && $limit != $conf->liste_limit) { |
673 | 673 | $filters .= '&limit='.((int) $limit); |
674 | 674 | } |
675 | -if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
676 | -if (!empty($salert)) $filters .= '&salert='.urlencode($salert); |
|
675 | +if (!empty($includeproductswithoutdesiredqty)) { |
|
676 | + $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
677 | +} |
|
678 | +if (!empty($salert)) { |
|
679 | + $filters .= '&salert='.urlencode($salert); |
|
680 | +} |
|
677 | 681 | |
678 | 682 | $param = (isset($type) ? '&type='.urlencode($type) : ''); |
679 | 683 | $param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder); |
@@ -681,8 +685,12 @@ discard block |
||
681 | 685 | $param .= '&mode='.urlencode($mode); |
682 | 686 | $param .= '&fk_supplier='.urlencode($fk_supplier); |
683 | 687 | $param .= '&fk_entrepot='.urlencode($fk_entrepot); |
684 | -if (!empty($includeproductswithoutdesiredqty)) $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
685 | -if (!empty($salert)) $param .= '&salert='.urlencode($salert); |
|
688 | +if (!empty($includeproductswithoutdesiredqty)) { |
|
689 | + $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); |
|
690 | +} |
|
691 | +if (!empty($salert)) { |
|
692 | + $param .= '&salert='.urlencode($salert); |
|
693 | +} |
|
686 | 694 | |
687 | 695 | $stocklabel = $langs->trans('Stock'); |
688 | 696 | $stocklabelbis = $langs->trans('Stock'); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | // Get parameters |
35 | 35 | $id = GETPOST('id', 'int'); |
36 | -$ref = GETPOST('ref', 'alpha'); |
|
36 | +$ref = GETPOST('ref', 'alpha'); |
|
37 | 37 | $action = GETPOST('action', 'aZ09'); |
38 | 38 | |
39 | 39 | // Initialize technical objects |