@@ -829,7 +829,10 @@ |
||
829 | 829 | break; // Should not happen |
830 | 830 | } |
831 | 831 | |
832 | - if (empty($obj->country_code)) $obj->country_code = ''; // TODO Add join in select with country table to get country_code |
|
832 | + if (empty($obj->country_code)) { |
|
833 | + $obj->country_code = ''; |
|
834 | + } |
|
835 | + // TODO Add join in select with country table to get country_code |
|
833 | 836 | |
834 | 837 | // Store properties in $object |
835 | 838 | $object->setVarsFromFetchObj($obj); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | 'u.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), |
140 | 140 | ); |
141 | 141 | // Extra fields |
142 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
142 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
143 | 143 | |
144 | 144 | $object->fields = dol_sort_array($object->fields, 'position'); |
145 | 145 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | if ($searchCategoryUserOperator == 0) { |
452 | 452 | $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).")"; |
453 | 453 | } else { |
454 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryUser); |
|
454 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryUser); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | break; // Should not happen |
936 | 936 | } |
937 | 937 | |
938 | - if (empty($obj->country_code)) $obj->country_code = ''; // TODO Add join in select with country table to get country_code |
|
938 | + if (empty($obj->country_code)) $obj->country_code = ''; // TODO Add join in select with country table to get country_code |
|
939 | 939 | |
940 | 940 | // Store properties in $object |
941 | 941 | $object->setVarsFromFetchObj($obj); |
@@ -270,7 +270,7 @@ |
||
270 | 270 | $reponsesadd = str_split($obj->reponses); |
271 | 271 | $lengthresponses = count($reponsesadd); |
272 | 272 | for ($cpt = $lengthresponses; $cpt > $cleinsertion; $cpt--) { |
273 | - $reponsesadd[$cpt] = $reponsesadd[$cpt-1]; |
|
273 | + $reponsesadd[$cpt] = $reponsesadd[$cpt - 1]; |
|
274 | 274 | } |
275 | 275 | $reponsesadd[$cleinsertion] = '0'; |
276 | 276 | $reponsesadd = implode($reponsesadd); |
@@ -436,8 +436,12 @@ discard block |
||
436 | 436 | $tmpuser->fetch($object->user_author_id); |
437 | 437 | |
438 | 438 | $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); |
439 | - if ($tmpuser->email) $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; |
|
440 | - if ($tmpuser->office_phone) $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; |
|
439 | + if ($tmpuser->email) { |
|
440 | + $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; |
|
441 | + } |
|
442 | + if ($tmpuser->office_phone) { |
|
443 | + $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; |
|
444 | + } |
|
441 | 445 | |
442 | 446 | $notetoshow = dol_concatdesc($notetoshow, $creator_info); |
443 | 447 | } |
@@ -1519,7 +1523,9 @@ discard block |
||
1519 | 1523 | global $conf, $langs; |
1520 | 1524 | |
1521 | 1525 | $ltrdirection = 'L'; |
1522 | - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; |
|
1526 | + if ($outputlangs->trans("DIRECTION") == 'rtl') { |
|
1527 | + $ltrdirection = 'R'; |
|
1528 | + } |
|
1523 | 1529 | |
1524 | 1530 | // Load traductions files required by page |
1525 | 1531 | $outputlangs->loadLangs(array("main", "propal", "companies", "bills")); |
@@ -197,12 +197,18 @@ discard block |
||
197 | 197 | |
198 | 198 | // Clean parameters |
199 | 199 | $price = price2num($price, 'MU'); // Clean value for the casse we receive a float zero value, to have it a real zero value. |
200 | - if (empty($price)) $price = 0; |
|
200 | + if (empty($price)) { |
|
201 | + $price = 0; |
|
202 | + } |
|
201 | 203 | $now = (!empty($datem) ? $datem : dol_now()); |
202 | 204 | |
203 | 205 | // Check parameters |
204 | - if (!($fk_product > 0)) return 0; |
|
205 | - if (!($entrepot_id > 0)) return 0; |
|
206 | + if (!($fk_product > 0)) { |
|
207 | + return 0; |
|
208 | + } |
|
209 | + if (!($entrepot_id > 0)) { |
|
210 | + return 0; |
|
211 | + } |
|
206 | 212 | |
207 | 213 | if (is_numeric($eatby) && $eatby < 0) { |
208 | 214 | dol_syslog(get_class($this)."::_create start ErrorBadValueForParameterEatBy eatby = ".$eatby); |
@@ -245,7 +251,9 @@ discard block |
||
245 | 251 | // Define if we must make the stock change (If product type is a service or if stock is used also for services) |
246 | 252 | // Only record into stock tables wil be disabled by this (the rest like writing into lot table or movement of subproucts are done) |
247 | 253 | $movestock = 0; |
248 | - if ($product->type != Product::TYPE_SERVICE || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) $movestock = 1; |
|
254 | + if ($product->type != Product::TYPE_SERVICE || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
|
255 | + $movestock = 1; |
|
256 | + } |
|
249 | 257 | |
250 | 258 | $this->db->begin(); |
251 | 259 | |
@@ -377,7 +385,9 @@ discard block |
||
377 | 385 | } |
378 | 386 | |
379 | 387 | $foundforbatch = 1; |
380 | - if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; |
|
388 | + if ($prodbatch->qty < abs($qty)) { |
|
389 | + $qtyisnotenough = $prodbatch->qty; |
|
390 | + } |
|
381 | 391 | break; |
382 | 392 | } |
383 | 393 | if (!$foundforbatch || $qtyisnotenough) { |
@@ -578,7 +588,9 @@ discard block |
||
578 | 588 | if ($movestock && !$error) { |
579 | 589 | // Call trigger |
580 | 590 | $result = $this->call_trigger('STOCK_MOVEMENT', $user); |
581 | - if ($result < 0) $error++; |
|
591 | + if ($result < 0) { |
|
592 | + $error++; |
|
593 | + } |
|
582 | 594 | // End call triggers |
583 | 595 | |
584 | 596 | // Check unicity for serial numbered equipments once all movement were done. |
@@ -845,7 +857,9 @@ discard block |
||
845 | 857 | $resql = $this->db->query($sql); |
846 | 858 | if ($resql) { |
847 | 859 | $obj = $this->db->fetch_object($resql); |
848 | - if ($obj) $nb = $obj->nb; |
|
860 | + if ($obj) { |
|
861 | + $nb = $obj->nb; |
|
862 | + } |
|
849 | 863 | return (empty($nb) ? 0 : $nb); |
850 | 864 | } else { |
851 | 865 | dol_print_error($this->db); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'skip_batch' => &$skip_batch, |
199 | 199 | 'id_product_batch' => &$id_product_batch |
200 | 200 | ); |
201 | - $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
201 | + $reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
202 | 202 | |
203 | 203 | if ($reshook < 0) { |
204 | 204 | if (!empty($hookmanager->resPrint)) { |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | $this->price = $obj->price; |
666 | 666 | $this->fk_user_author = $obj->fk_user_author; |
667 | 667 | $this->label = $obj->label; |
668 | - $this->fk_origin = $obj->origin_id; // For backward compatibility |
|
669 | - $this->origintype = $obj->origin_type; // For backward compatibility |
|
668 | + $this->fk_origin = $obj->origin_id; // For backward compatibility |
|
669 | + $this->origintype = $obj->origin_type; // For backward compatibility |
|
670 | 670 | $this->origin_id = $obj->origin_id; |
671 | 671 | $this->origin_type = $obj->origin_type; |
672 | 672 | $this->inventorycode = $obj->inventorycode; |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | } else { // product_batch record not found |
895 | 895 | $pdluo->fk_product_stock = $vfk_product_stock; |
896 | 896 | $pdluo->qty = $qty; |
897 | - $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table. |
|
898 | - $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table. |
|
897 | + $pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table. |
|
898 | + $pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table. |
|
899 | 899 | $pdluo->batch = $vbatchnumber; |
900 | 900 | |
901 | 901 | $result = $pdluo->create($user, 1); |
@@ -1205,8 +1205,8 @@ discard block |
||
1205 | 1205 | $sql = "SELECT sum(pb.qty) as cpt"; |
1206 | 1206 | $sql .= " FROM ".$this->db->prefix()."product_batch as pb"; |
1207 | 1207 | $sql .= " INNER JOIN ".$this->db->prefix()."product_stock as ps ON ps.rowid = pb.fk_product_stock"; |
1208 | - $sql .= " WHERE ps.fk_product = " . ((int) $fk_product); |
|
1209 | - $sql .= " AND pb.batch = '" . $this->db->escape($batch) . "'"; |
|
1208 | + $sql .= " WHERE ps.fk_product = ".((int) $fk_product); |
|
1209 | + $sql .= " AND pb.batch = '".$this->db->escape($batch)."'"; |
|
1210 | 1210 | |
1211 | 1211 | $result = $this->db->query($sql); |
1212 | 1212 | if ($result) { |
@@ -113,8 +113,10 @@ |
||
113 | 113 | $search_all = GETPOST("search_all", 'alpha'); |
114 | 114 | $search = array(); |
115 | 115 | foreach ($object->fields as $key => $val) { |
116 | - if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
117 | -} |
|
116 | + if (GETPOST('search_'.$key, 'alpha') !== '') { |
|
117 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
118 | + } |
|
119 | + } |
|
118 | 120 | |
119 | 121 | // List of fields to search into when doing a "search in all" |
120 | 122 | $fieldstosearchall = array(); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $this->menu = array(); |
264 | 264 | $r = 0; |
265 | 265 | // Add here entries to declare new menus |
266 | - $this->menu[$r++]=array( |
|
266 | + $this->menu[$r++] = array( |
|
267 | 267 | // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
268 | 268 | 'fk_menu'=>'fk_mainmenu=mrp', |
269 | 269 | // This is a Left menu entry |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | 'url'=>'', |
276 | 276 | // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
277 | 277 | 'langs'=>'mrp', |
278 | - 'position'=>1100+$r, |
|
278 | + 'position'=>1100 + $r, |
|
279 | 279 | // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
280 | 280 | 'enabled'=>'$conf->workstation->enabled', |
281 | 281 | // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // 0=Menu for internal users, 1=external users, 2=both |
285 | 285 | 'user'=>2, |
286 | 286 | ); |
287 | - $this->menu[$r++]=array( |
|
287 | + $this->menu[$r++] = array( |
|
288 | 288 | // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
289 | 289 | 'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', |
290 | 290 | // This is a Left menu entry |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 'url'=>'/workstation/workstation_card.php?action=create', |
296 | 296 | // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
297 | 297 | 'langs'=>'mrp', |
298 | - 'position'=>1100+$r, |
|
298 | + 'position'=>1100 + $r, |
|
299 | 299 | // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
300 | 300 | 'enabled'=>'$conf->workstation->enabled', |
301 | 301 | // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | // 0=Menu for internal users, 1=external users, 2=both |
305 | 305 | 'user'=>2 |
306 | 306 | ); |
307 | - $this->menu[$r++]=array( |
|
307 | + $this->menu[$r++] = array( |
|
308 | 308 | // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
309 | 309 | 'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation', |
310 | 310 | // This is a Left menu entry |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | 'url'=>'/workstation/workstation_list.php', |
316 | 316 | // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
317 | 317 | 'langs'=>'mrp', |
318 | - 'position'=>1101+$r, |
|
318 | + 'position'=>1101 + $r, |
|
319 | 319 | // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
320 | 320 | 'enabled'=>'$conf->workstation->enabled', |
321 | 321 | // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | // Load variable for pagination |
83 | -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
83 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
84 | 84 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
85 | 85 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
86 | -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
86 | +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
87 | 87 | if (empty($page) || $page == -1) { |
88 | 88 | $page = 0; |
89 | 89 | } // If $page is not defined, or '' or -1 |
@@ -98,34 +98,34 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | -$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
|
101 | +$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
|
102 | 102 | |
103 | 103 | $search_ref = GETPOST('search_ref', 'alpha'); |
104 | 104 | $search_user = GETPOST('search_user', 'int'); |
105 | -$search_amount_ht = GETPOST('search_amount_ht', 'alpha'); |
|
105 | +$search_amount_ht = GETPOST('search_amount_ht', 'alpha'); |
|
106 | 106 | $search_amount_vat = GETPOST('search_amount_vat', 'alpha'); |
107 | 107 | $search_amount_ttc = GETPOST('search_amount_ttc', 'alpha'); |
108 | -$search_status = (GETPOST('search_status', 'intcomma') != '' ?GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); |
|
108 | +$search_status = (GETPOST('search_status', 'intcomma') != '' ?GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); |
|
109 | 109 | |
110 | -$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
110 | +$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
111 | 111 | $search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
112 | -$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
112 | +$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
113 | 113 | $search_date_startendday = GETPOST('search_date_startendday', 'int'); |
114 | -$search_date_startendmonth = GETPOST('search_date_startendmonth', 'int'); |
|
115 | -$search_date_startendyear = GETPOST('search_date_startendyear', 'int'); |
|
116 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
114 | +$search_date_startendmonth = GETPOST('search_date_startendmonth', 'int'); |
|
115 | +$search_date_startendyear = GETPOST('search_date_startendyear', 'int'); |
|
116 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
117 | 117 | $search_date_startend = dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear); |
118 | 118 | |
119 | 119 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
120 | 120 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
121 | 121 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
122 | -$search_date_endendday = GETPOST('search_date_endendday', 'int'); |
|
122 | +$search_date_endendday = GETPOST('search_date_endendday', 'int'); |
|
123 | 123 | $search_date_endendmonth = GETPOST('search_date_endendmonth', 'int'); |
124 | 124 | $search_date_endendyear = GETPOST('search_date_endendyear', 'int'); |
125 | -$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Use tzserver |
|
126 | -$search_date_endend = dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear); |
|
125 | +$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Use tzserver |
|
126 | +$search_date_endend = dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear); |
|
127 | 127 | |
128 | -$optioncss = GETPOST('optioncss', 'alpha'); |
|
128 | +$optioncss = GETPOST('optioncss', 'alpha'); |
|
129 | 129 | |
130 | 130 | if ($search_status == '') { |
131 | 131 | $search_status = -1; |
@@ -961,7 +961,7 @@ |
||
961 | 961 | if (!empty($activefilter)) { // Use a predefined trusted filter (defined into setup by admin). |
962 | 962 | if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter) { |
963 | 963 | $filter = '('.$this->filter.')'; |
964 | - } elseif (((string) $activefilter == 'group') && $this->filtergroup ) { |
|
964 | + } elseif (((string) $activefilter == 'group') && $this->filtergroup) { |
|
965 | 965 | $filter = '('.$this->filtergroup.')'; |
966 | 966 | } elseif (((string) $activefilter == 'member') && $this->filter) { |
967 | 967 | $filter = '('.$this->filtermember.')'; |
@@ -98,7 +98,7 @@ |
||
98 | 98 | /** |
99 | 99 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
100 | 100 | */ |
101 | - public $fields=array( |
|
101 | + public $fields = array( |
|
102 | 102 | 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), |
103 | 103 | 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'position'=>15, 'index'=>1), |
104 | 104 | 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), |