@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public $price; |
135 | 135 | |
136 | - public $price_formated; // used by takepos/ajax/ajax.php |
|
136 | + public $price_formated; // used by takepos/ajax/ajax.php |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Selling price with tax |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public $price_ttc; |
144 | 144 | |
145 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
145 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Minimum price net |
@@ -342,20 +342,20 @@ discard block |
||
342 | 342 | |
343 | 343 | //! Metric of products |
344 | 344 | public $weight; |
345 | - public $weight_units; // scale -3, 0, 3, 6 |
|
345 | + public $weight_units; // scale -3, 0, 3, 6 |
|
346 | 346 | public $length; |
347 | - public $length_units; // scale -3, 0, 3, 6 |
|
347 | + public $length_units; // scale -3, 0, 3, 6 |
|
348 | 348 | public $width; |
349 | - public $width_units; // scale -3, 0, 3, 6 |
|
349 | + public $width_units; // scale -3, 0, 3, 6 |
|
350 | 350 | public $height; |
351 | - public $height_units; // scale -3, 0, 3, 6 |
|
351 | + public $height_units; // scale -3, 0, 3, 6 |
|
352 | 352 | public $surface; |
353 | - public $surface_units; // scale -3, 0, 3, 6 |
|
353 | + public $surface_units; // scale -3, 0, 3, 6 |
|
354 | 354 | public $volume; |
355 | - public $volume_units; // scale -3, 0, 3, 6 |
|
355 | + public $volume_units; // scale -3, 0, 3, 6 |
|
356 | 356 | |
357 | 357 | public $net_measure; |
358 | - public $net_measure_units; // scale -3, 0, 3, 6 |
|
358 | + public $net_measure_units; // scale -3, 0, 3, 6 |
|
359 | 359 | |
360 | 360 | public $accountancy_code_sell; |
361 | 361 | public $accountancy_code_sell_intra; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), |
534 | 534 | //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
535 | 535 | //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
536 | - 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
536 | + 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
537 | 537 | ); |
538 | 538 | |
539 | 539 | /** |
@@ -831,9 +831,9 @@ discard block |
||
831 | 831 | |
832 | 832 | // update accountancy for this entity |
833 | 833 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
834 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
834 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
835 | 835 | |
836 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
836 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
837 | 837 | $sql .= " fk_product"; |
838 | 838 | $sql .= ", entity"; |
839 | 839 | $sql .= ", accountancy_code_buy"; |
@@ -844,13 +844,13 @@ discard block |
||
844 | 844 | $sql .= ", accountancy_code_sell_export"; |
845 | 845 | $sql .= ") VALUES ("; |
846 | 846 | $sql .= $this->id; |
847 | - $sql .= ", " . $conf->entity; |
|
848 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
849 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
850 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
851 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
852 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
853 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
847 | + $sql .= ", ".$conf->entity; |
|
848 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
849 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
850 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
851 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
852 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
853 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
854 | 854 | $sql .= ")"; |
855 | 855 | $result = $this->db->query($sql); |
856 | 856 | if (!$result) { |
@@ -1214,12 +1214,12 @@ discard block |
||
1214 | 1214 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); |
1215 | 1215 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; |
1216 | 1216 | if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
1217 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1218 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1219 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1220 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1221 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1222 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1217 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1218 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1219 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1220 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1221 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1222 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1223 | 1223 | } |
1224 | 1224 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); |
1225 | 1225 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); |
1228 | 1228 | $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); |
1229 | 1229 | $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); |
1230 | - $sql .= ", mandatory_period = ".($this->mandatory_period ); |
|
1230 | + $sql .= ", mandatory_period = ".($this->mandatory_period); |
|
1231 | 1231 | // stock field is not here because it is a denormalized value from product_stock. |
1232 | 1232 | $sql .= " WHERE rowid = ".((int) $id); |
1233 | 1233 | |
@@ -1249,9 +1249,9 @@ discard block |
||
1249 | 1249 | |
1250 | 1250 | // update accountancy for this entity |
1251 | 1251 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
1252 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
1252 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
1253 | 1253 | |
1254 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
1254 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
1255 | 1255 | $sql .= " fk_product"; |
1256 | 1256 | $sql .= ", entity"; |
1257 | 1257 | $sql .= ", accountancy_code_buy"; |
@@ -1262,13 +1262,13 @@ discard block |
||
1262 | 1262 | $sql .= ", accountancy_code_sell_export"; |
1263 | 1263 | $sql .= ") VALUES ("; |
1264 | 1264 | $sql .= $this->id; |
1265 | - $sql .= ", " . $conf->entity; |
|
1266 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1267 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1268 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1269 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1270 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1271 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1265 | + $sql .= ", ".$conf->entity; |
|
1266 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1267 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1268 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1269 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1270 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1271 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1272 | 1272 | $sql .= ")"; |
1273 | 1273 | $result = $this->db->query($sql); |
1274 | 1274 | if (!$result) { |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | } |
1567 | 1567 | } elseif (isset($this->multilangs[$key])) { |
1568 | 1568 | if (empty($this->multilangs["$key"]["label"])) { |
1569 | - $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
1569 | + $this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
1570 | 1570 | return -1; |
1571 | 1571 | } |
1572 | 1572 | |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | private function getArrayForPriceCompare($level = 0) |
1763 | 1763 | { |
1764 | 1764 | |
1765 | - $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); |
|
1765 | + $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); |
|
1766 | 1766 | |
1767 | 1767 | foreach ($testExit as $field) { |
1768 | 1768 | if (!isset($this->$field)) { |
@@ -2385,20 +2385,20 @@ discard block |
||
2385 | 2385 | |
2386 | 2386 | //For MultiCompany |
2387 | 2387 | //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity |
2388 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2389 | - $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2388 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2389 | + $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2390 | 2390 | $visibleWarehousesEntities = $conf->entity; |
2391 | 2391 | if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { |
2392 | 2392 | if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { |
2393 | - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2394 | - if ($this->db->num_rows($checkPMPPerEntity)>0) { |
|
2393 | + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2394 | + if ($this->db->num_rows($checkPMPPerEntity) > 0) { |
|
2395 | 2395 | $separatedEntityPMP = true; |
2396 | 2396 | } |
2397 | 2397 | } |
2398 | 2398 | global $mc; |
2399 | 2399 | $separatedStock = true; |
2400 | 2400 | if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { |
2401 | - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); |
|
2401 | + $visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); |
|
2402 | 2402 | } |
2403 | 2403 | } |
2404 | 2404 | if ($separatedEntityPMP) { |
@@ -2415,10 +2415,10 @@ discard block |
||
2415 | 2415 | } |
2416 | 2416 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
2417 | 2417 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { |
2418 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
2418 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
2419 | 2419 | } |
2420 | 2420 | if ($separatedStock) { |
2421 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2421 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2422 | 2422 | } |
2423 | 2423 | |
2424 | 2424 | if ($id) { |
@@ -2573,15 +2573,15 @@ discard block |
||
2573 | 2573 | $sql .= " WHERE entity IN (".getEntity('productprice').")"; |
2574 | 2574 | $sql .= " AND price_level=".((int) $i); |
2575 | 2575 | $sql .= " AND fk_product = ".((int) $this->id); |
2576 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
2577 | - $sql .= " LIMIT 1"; // Only the first one |
|
2576 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
2577 | + $sql .= " LIMIT 1"; // Only the first one |
|
2578 | 2578 | $resql = $this->db->query($sql); |
2579 | 2579 | if ($resql) { |
2580 | 2580 | $result = $this->db->fetch_array($resql); |
2581 | 2581 | |
2582 | 2582 | $this->multiprices[$i] = $result ? $result["price"] : null; |
2583 | 2583 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; |
2584 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
2584 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
2585 | 2585 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; |
2586 | 2586 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; |
2587 | 2587 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on |
@@ -2801,7 +2801,7 @@ discard block |
||
2801 | 2801 | $obj = $this->db->fetch_object($result); |
2802 | 2802 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
2803 | 2803 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
2804 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
2804 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
2805 | 2805 | } else { |
2806 | 2806 | $this->error = $this->db->error(); |
2807 | 2807 | $error++; |
@@ -4258,7 +4258,7 @@ discard block |
||
4258 | 4258 | //Addition of a product with the highest rank +1 |
4259 | 4259 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; |
4260 | 4260 | $sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".price2num($incdec, 'MS').", ".((int) $rank).")"; |
4261 | - if (! $this->db->query($sql)) { |
|
4261 | + if (!$this->db->query($sql)) { |
|
4262 | 4262 | dol_print_error($this->db); |
4263 | 4263 | return -1; |
4264 | 4264 | } else { |
@@ -4341,17 +4341,17 @@ discard block |
||
4341 | 4341 | |
4342 | 4342 | // Updated ranks so that none are missing |
4343 | 4343 | $sqlrank = "SELECT rowid, rang FROM ".$this->db->prefix()."product_association"; |
4344 | - $sqlrank.= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
4345 | - $sqlrank.= " ORDER BY rang"; |
|
4344 | + $sqlrank .= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
4345 | + $sqlrank .= " ORDER BY rang"; |
|
4346 | 4346 | $resqlrank = $this->db->query($sqlrank); |
4347 | 4347 | if ($resqlrank) { |
4348 | 4348 | $cpt = 0; |
4349 | 4349 | while ($objrank = $this->db->fetch_object($resqlrank)) { |
4350 | 4350 | $cpt++; |
4351 | 4351 | $sql = "UPDATE ".$this->db->prefix()."product_association"; |
4352 | - $sql.= " SET rang = ".((int) $cpt); |
|
4353 | - $sql.= " WHERE rowid = ".((int) $objrank->rowid); |
|
4354 | - if (! $this->db->query($sql)) { |
|
4352 | + $sql .= " SET rang = ".((int) $cpt); |
|
4353 | + $sql .= " WHERE rowid = ".((int) $objrank->rowid); |
|
4354 | + if (!$this->db->query($sql)) { |
|
4355 | 4355 | dol_print_error($this->db); |
4356 | 4356 | return -1; |
4357 | 4357 | } |
@@ -4929,9 +4929,9 @@ discard block |
||
4929 | 4929 | $sql .= " WHERE p.rowid = pa.fk_product_fils"; |
4930 | 4930 | $sql .= " AND pa.fk_product_pere = ".((int) $id); |
4931 | 4931 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens |
4932 | - $sql.= " ORDER BY pa.rang"; |
|
4932 | + $sql .= " ORDER BY pa.rang"; |
|
4933 | 4933 | |
4934 | - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); |
|
4934 | + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ?implode(',', $parents) : $parents), LOG_DEBUG); |
|
4935 | 4935 | |
4936 | 4936 | if ($level == 1) { |
4937 | 4937 | $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly |
@@ -5021,7 +5021,7 @@ discard block |
||
5021 | 5021 | if (!empty($this->entity)) { |
5022 | 5022 | $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80); |
5023 | 5023 | if ($this->nbphoto > 0) { |
5024 | - $datas['photo'] = '<div class="photointooltip floatright">' . $tmpphoto . '</div>'; |
|
5024 | + $datas['photo'] = '<div class="photointooltip floatright">'.$tmpphoto.'</div>'; |
|
5025 | 5025 | //$label .= '<div style="clear: both;"></div>'; |
5026 | 5026 | } |
5027 | 5027 | } |
@@ -5029,31 +5029,31 @@ discard block |
||
5029 | 5029 | if ($this->type == Product::TYPE_PRODUCT) { |
5030 | 5030 | $datas['picto'] = img_picto('', 'product').' <u class="paddingrightonly">'.$langs->trans("Product").'</u>'; |
5031 | 5031 | } elseif ($this->type == Product::TYPE_SERVICE) { |
5032 | - $datas['picto']= img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
5032 | + $datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
5033 | 5033 | } |
5034 | 5034 | if (isset($this->status) && isset($this->status_buy)) { |
5035 | - $datas['status']= ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); |
|
5035 | + $datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1); |
|
5036 | 5036 | } |
5037 | 5037 | |
5038 | 5038 | if (!empty($this->ref)) { |
5039 | - $datas['ref']= '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
5039 | + $datas['ref'] = '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
5040 | 5040 | } |
5041 | 5041 | if (!empty($this->label)) { |
5042 | - $datas['label']= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
5042 | + $datas['label'] = '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
5043 | 5043 | } |
5044 | 5044 | if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
5045 | 5045 | if (isModEnabled('productbatch')) { |
5046 | 5046 | $langs->load("productbatch"); |
5047 | - $datas['batchstatus']= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
5047 | + $datas['batchstatus'] = "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
5048 | 5048 | } |
5049 | 5049 | } |
5050 | 5050 | if (isModEnabled('barcode')) { |
5051 | - $datas['barcode']= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
5051 | + $datas['barcode'] = '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
5052 | 5052 | } |
5053 | 5053 | |
5054 | 5054 | if ($this->type == Product::TYPE_PRODUCT) { |
5055 | 5055 | if ($this->weight) { |
5056 | - $datas['weight']= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
5056 | + $datas['weight'] = "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
5057 | 5057 | } |
5058 | 5058 | $labelsize = ""; |
5059 | 5059 | if ($this->length) { |
@@ -5066,7 +5066,7 @@ discard block |
||
5066 | 5066 | $labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); |
5067 | 5067 | } |
5068 | 5068 | if ($labelsize) { |
5069 | - $datas['size']= "<br>".$labelsize; |
|
5069 | + $datas['size'] = "<br>".$labelsize; |
|
5070 | 5070 | } |
5071 | 5071 | |
5072 | 5072 | $labelsurfacevolume = ""; |
@@ -5077,7 +5077,7 @@ discard block |
||
5077 | 5077 | $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); |
5078 | 5078 | } |
5079 | 5079 | if ($labelsurfacevolume) { |
5080 | - $datas['surface']= "<br>" . $labelsurfacevolume; |
|
5080 | + $datas['surface'] = "<br>".$labelsurfacevolume; |
|
5081 | 5081 | } |
5082 | 5082 | } |
5083 | 5083 | if (!empty($this->pmp) && $this->pmp) { |
@@ -5107,9 +5107,9 @@ discard block |
||
5107 | 5107 | } |
5108 | 5108 | // show categories for this record only in ajax to not overload lists |
5109 | 5109 | if (isModEnabled('categorie') && !$nofetch) { |
5110 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5110 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
5111 | 5111 | $form = new Form($this->db); |
5112 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
5112 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
5113 | 5113 | } |
5114 | 5114 | |
5115 | 5115 | return $datas; |
@@ -5338,7 +5338,7 @@ discard block |
||
5338 | 5338 | $labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial')); |
5339 | 5339 | $labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort')); |
5340 | 5340 | } |
5341 | - } elseif ( $type == 2 && $status == 2 ) { |
|
5341 | + } elseif ($type == 2 && $status == 2) { |
|
5342 | 5342 | $labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial'); |
5343 | 5343 | $labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'); |
5344 | 5344 | } |
@@ -5545,7 +5545,7 @@ discard block |
||
5545 | 5545 | $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; |
5546 | 5546 | } |
5547 | 5547 | |
5548 | - $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; |
|
5548 | + $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE) ? 'DESC' : 'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; |
|
5549 | 5549 | |
5550 | 5550 | dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); |
5551 | 5551 | $result = $this->db->query($sql); |
@@ -5626,7 +5626,7 @@ discard block |
||
5626 | 5626 | if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { |
5627 | 5627 | $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; |
5628 | 5628 | if (isset($includedraftpoforvirtual)) { |
5629 | - $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
5629 | + $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
5630 | 5630 | } |
5631 | 5631 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); |
5632 | 5632 | if ($result < 0) { |
@@ -6331,7 +6331,7 @@ discard block |
||
6331 | 6331 | global $langs; |
6332 | 6332 | |
6333 | 6333 | if (empty($this->duration_value)) { |
6334 | - $this->errors[]='ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
6334 | + $this->errors[] = 'ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
6335 | 6335 | return -1; |
6336 | 6336 | } |
6337 | 6337 | |
@@ -6367,7 +6367,7 @@ discard block |
||
6367 | 6367 | */ |
6368 | 6368 | public function getKanbanView($option = '') |
6369 | 6369 | { |
6370 | - global $langs,$conf; |
|
6370 | + global $langs, $conf; |
|
6371 | 6371 | |
6372 | 6372 | $return = '<div class="box-flex-item box-flex-grow-zero">'; |
6373 | 6373 | $return .= '<div class="info-box info-box-sm">'; |
@@ -6403,7 +6403,7 @@ discard block |
||
6403 | 6403 | $return .= '<br><span class="info-box-status opacitymedium">'.$langs->trans('PhysicalStock').' : <span class="bold">'.$this->stock_reel.'</span></span>'; |
6404 | 6404 | } |
6405 | 6405 | if (method_exists($this, 'getLibStatut')) { |
6406 | - $return .='<br><span class="info-box-status margintoponly">'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).'</span>'; |
|
6406 | + $return .= '<br><span class="info-box-status margintoponly">'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).'</span>'; |
|
6407 | 6407 | } |
6408 | 6408 | $return .= '</div>'; |
6409 | 6409 | $return .= '</div>'; |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $error++; |
714 | 714 | } |
715 | 715 | |
716 | - $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
716 | + $dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
717 | 717 | $datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver'); |
718 | 718 | //var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); |
719 | 719 | //var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); |
@@ -962,26 +962,26 @@ discard block |
||
962 | 962 | $tmpproject = GETPOST('projectid', 'int'); |
963 | 963 | |
964 | 964 | // Creation invoice |
965 | + $object->socid = GETPOST('socid', 'int'); |
|
966 | + $object->type = GETPOST('type', 'alphanohtml'); |
|
967 | + $object->ref = GETPOST('ref', 'alphanohtml'); |
|
968 | + $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
965 | 969 | $object->socid = GETPOST('socid', 'int'); |
966 | - $object->type = GETPOST('type', 'alphanohtml'); |
|
967 | - $object->ref = GETPOST('ref', 'alphanohtml'); |
|
968 | - $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
969 | - $object->socid = GETPOST('socid', 'int'); |
|
970 | - $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
970 | + $object->libelle = GETPOST('label', 'alphanohtml'); // deprecated |
|
971 | 971 | $object->label = GETPOST('label', 'alphanohtml'); |
972 | - $object->date = $dateinvoice; |
|
973 | - $object->date_echeance = $datedue; |
|
974 | - $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
975 | - $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
972 | + $object->date = $dateinvoice; |
|
973 | + $object->date_echeance = $datedue; |
|
974 | + $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
975 | + $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
976 | 976 | $object->cond_reglement_id = GETPOST('cond_reglement_id'); |
977 | 977 | $object->mode_reglement_id = GETPOST('mode_reglement_id'); |
978 | 978 | $object->fk_account = GETPOST('fk_account', 'int'); |
979 | 979 | $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; |
980 | - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
980 | + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); |
|
981 | 981 | $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
982 | 982 | $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); |
983 | - $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); |
|
984 | - $object->transport_mode_id = GETPOST('transport_mode_id'); |
|
983 | + $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); |
|
984 | + $object->transport_mode_id = GETPOST('transport_mode_id'); |
|
985 | 985 | |
986 | 986 | // Auto calculation of date due if not filled by user |
987 | 987 | if (empty($object->date_echeance)) { |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | // Edit line |
1321 | 1321 | $db->begin(); |
1322 | 1322 | |
1323 | - if (! $object->fetch($id) > 0) { |
|
1323 | + if (!$object->fetch($id) > 0) { |
|
1324 | 1324 | dol_print_error($db); |
1325 | 1325 | } |
1326 | 1326 | $object->fetch_thirdparty(); |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $idprod = GETPOST('idprod', 'int'); |
1465 | 1465 | } |
1466 | 1466 | |
1467 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1467 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1468 | 1468 | |
1469 | 1469 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
1470 | 1470 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -2218,7 +2218,7 @@ discard block |
||
2218 | 2218 | |
2219 | 2219 | $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; |
2220 | 2220 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r'; |
2221 | - $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid; |
|
2221 | + $sql .= ' WHERE r.fk_soc = '.(int) $invoice_predefined->socid; |
|
2222 | 2222 | |
2223 | 2223 | $resql = $db->query($sql); |
2224 | 2224 | if ($resql) { |
@@ -2277,7 +2277,7 @@ discard block |
||
2277 | 2277 | |
2278 | 2278 | // Standard invoice |
2279 | 2279 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; |
2280 | - $tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int')? '' : 'checked').'> '; |
|
2280 | + $tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int') ? '' : 'checked').'> '; |
|
2281 | 2281 | $desc = $form->textwithpicto($tmp.'<label for="radio_standard">'.$langs->trans("InvoiceStandardAsk").'</label>', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); |
2282 | 2282 | print $desc; |
2283 | 2283 | print '</div></div>'; |
@@ -2286,7 +2286,7 @@ discard block |
||
2286 | 2286 | // Deposit - Down payment |
2287 | 2287 | if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { |
2288 | 2288 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; |
2289 | - $tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; |
|
2289 | + $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> '; |
|
2290 | 2290 | print '<script type="text/javascript"> |
2291 | 2291 | jQuery(document).ready(function() { |
2292 | 2292 | jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { |
@@ -2332,7 +2332,7 @@ discard block |
||
2332 | 2332 | print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); |
2333 | 2333 | print '</td>'; |
2334 | 2334 | print '<td class="nowrap" style="padding-left: 5px">'; |
2335 | - print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="' . GETPOST('valuedeposit', 'int') . '"/>'; |
|
2335 | + print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOST('valuedeposit', 'int').'"/>'; |
|
2336 | 2336 | print '</td>'; |
2337 | 2337 | } |
2338 | 2338 | print '</tr></table>'; |
@@ -2487,7 +2487,7 @@ discard block |
||
2487 | 2487 | if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { |
2488 | 2488 | $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> '; |
2489 | 2489 | } else { |
2490 | - $tmp='<input type="radio" name="type" id="radio_creditnote" value="2"> '; |
|
2490 | + $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2"> '; |
|
2491 | 2491 | } |
2492 | 2492 | $text = $tmp.$langs->trans("InvoiceAvoir").' '; |
2493 | 2493 | $text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").')</span> '; |
@@ -3066,7 +3066,7 @@ discard block |
||
3066 | 3066 | $facavoir->fetch($id); |
3067 | 3067 | $invoicecredits[] = $facavoir->getNomUrl(1); |
3068 | 3068 | } |
3069 | - print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); |
|
3069 | + print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir").(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits); |
|
3070 | 3070 | print '</span>'; |
3071 | 3071 | } |
3072 | 3072 | if (isset($objectidnext) && $objectidnext > 0) { |
@@ -3667,7 +3667,7 @@ discard block |
||
3667 | 3667 | print '<tr><td colspan="'.$nbcols.'" class="right">'; |
3668 | 3668 | print '<span class="opacitymedium">'; |
3669 | 3669 | print $langs->trans('RemainderToPayBackMulticurrency'); |
3670 | - if ($resteapayeraffiche> 0) { |
|
3670 | + if ($resteapayeraffiche > 0) { |
|
3671 | 3671 | print ' ('.$langs->trans('NegativeIfExcessRefunded').')'; |
3672 | 3672 | } |
3673 | 3673 | print '</span>'; |
@@ -3895,7 +3895,7 @@ discard block |
||
3895 | 3895 | } |
3896 | 3896 | |
3897 | 3897 | // Clone as predefined / Create template |
3898 | - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) { |
|
3898 | + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) { |
|
3899 | 3899 | if (!$objectidnext && count($object->lines) > 0) { |
3900 | 3900 | print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; |
3901 | 3901 | } |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | |
141 | 141 | if (!$error) { |
142 | 142 | if ($action == 'add' || (GETPOST('add') && $action != 'update')) { |
143 | - $object->type=$mode; |
|
144 | - $object->user_id=0; |
|
145 | - $object->page=$defaulturl; |
|
146 | - $object->param=$defaultkey; |
|
147 | - $object->value=$defaultvalue; |
|
148 | - $object->entity=$conf->entity; |
|
149 | - $result=$object->create($user); |
|
143 | + $object->type = $mode; |
|
144 | + $object->user_id = 0; |
|
145 | + $object->page = $defaulturl; |
|
146 | + $object->param = $defaultkey; |
|
147 | + $object->value = $defaultvalue; |
|
148 | + $object->entity = $conf->entity; |
|
149 | + $result = $object->create($user); |
|
150 | 150 | if ($result < 0) { |
151 | 151 | $action = ''; |
152 | 152 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | if (GETPOST('actionmodify')) { |
162 | - $object->id=$id; |
|
163 | - $object->type=$mode; |
|
164 | - $object->page=$urlpage; |
|
165 | - $object->param=$key; |
|
166 | - $object->value=$value; |
|
167 | - $object->entity=$conf->entity; |
|
168 | - $result=$object->update($user); |
|
169 | - if ($result<0) { |
|
162 | + $object->id = $id; |
|
163 | + $object->type = $mode; |
|
164 | + $object->page = $urlpage; |
|
165 | + $object->param = $key; |
|
166 | + $object->value = $value; |
|
167 | + $object->entity = $conf->entity; |
|
168 | + $result = $object->update($user); |
|
169 | + if ($result < 0) { |
|
170 | 170 | $action = ''; |
171 | 171 | setEventMessages($object->error, $object->errors, 'errors'); |
172 | 172 | } else { |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | |
183 | 183 | // Delete line from delete picto |
184 | 184 | if ($action == 'delete') { |
185 | - $object->id=$id; |
|
186 | - $result=$object->delete($user); |
|
187 | - if ($result<0) { |
|
185 | + $object->id = $id; |
|
186 | + $result = $object->delete($user); |
|
187 | + if ($result < 0) { |
|
188 | 188 | $action = ''; |
189 | 189 | setEventMessages($object->error, $object->errors, 'errors'); |
190 | 190 | } |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | // Limit to superadmin |
340 | 340 | if (isModEnabled('multicompany') && !$user->entity) { |
341 | 341 | print '<td>'; |
342 | - print '<input type="text" class="flat" size="1" disabled name="entity" value="' . $conf->entity . '">'; // We see environment, but to change it we must switch on other entity |
|
342 | + print '<input type="text" class="flat" size="1" disabled name="entity" value="'.$conf->entity.'">'; // We see environment, but to change it we must switch on other entity |
|
343 | 343 | print '</td>'; |
344 | 344 | } else { |
345 | 345 | print '<td class="center">'; |
346 | - print '<input type="hidden" name="entity" value="' . $conf->entity . '">'; |
|
346 | + print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; |
|
347 | 347 | print '</td>'; |
348 | 348 | } |
349 | 349 | print '<td class="center">'; |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | print '</td>'."\n"; |
356 | 356 | print '</tr>'."\n"; |
357 | 357 | |
358 | -$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity))); |
|
358 | +$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode, 't.entity'=>array($user->entity, $conf->entity))); |
|
359 | 359 | |
360 | 360 | if (!is_array($result) && $result < 0) { |
361 | 361 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | // Actions |
389 | 389 | print '<td class="center">'; |
390 | - if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { |
|
390 | + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { |
|
391 | 391 | print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=edit&token='.newToken().'">'.img_edit().'</a>'; |
392 | 392 | print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$defaultvalue->id.'&entity='.$defaultvalue->entity.'&mode='.$mode.'&action=delete&token='.newToken().'">'.img_delete().'</a>'; |
393 | 393 | } else { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $sql .= " AND k.fk_soc= ".((int) $user->socid); |
119 | 119 | } |
120 | 120 | |
121 | - $sql.= " AND k.status > 0"; |
|
121 | + $sql .= " AND k.status > 0"; |
|
122 | 122 | |
123 | 123 | $sql .= " ORDER BY k.tms DESC, k.rowid DESC "; |
124 | 124 | $sql .= $this->db->plimit($max, 0); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); |
164 | 164 | $this->info_box_contents[$i][$r] = array( |
165 | 165 | 'td' => 'class="tdoverflowmax100"', |
166 | - 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, |
|
166 | + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"').$labellang, |
|
167 | 167 | 'asis' => 1, |
168 | 168 | ); |
169 | 169 | $r++; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $sql .= " AND k.fk_soc= ".((int) $user->socid); |
119 | 119 | } |
120 | 120 | |
121 | - $sql.= " AND k.status > 0"; |
|
121 | + $sql .= " AND k.status > 0"; |
|
122 | 122 | |
123 | 123 | $sql .= " ORDER BY k.date_creation DESC, k.rowid DESC "; |
124 | 124 | $sql .= $this->db->plimit($max, 0); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); |
164 | 164 | $this->info_box_contents[$i][$r] = array( |
165 | 165 | 'td' => 'class="tdoverflowmax100"', |
166 | - 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, |
|
166 | + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"').$labellang, |
|
167 | 167 | 'asis' => 1, |
168 | 168 | ); |
169 | 169 | $r++; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | global $conf, $mc, $hookmanager, $object, $action, $db; |
193 | 193 | |
194 | - if (! is_object($hookmanager)) { |
|
194 | + if (!is_object($hookmanager)) { |
|
195 | 195 | $hookmanager = new HookManager($db); |
196 | 196 | } |
197 | 197 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | function num2Alpha($n) |
279 | 279 | { |
280 | 280 | for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) |
281 | - $r = chr($n % 26 + 0x41) . $r; |
|
281 | + $r = chr($n % 26 + 0x41).$r; |
|
282 | 282 | return $r; |
283 | 283 | } |
284 | 284 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $os = 'unknown'; |
309 | 309 | $phone = ''; |
310 | 310 | |
311 | - $user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent |
|
311 | + $user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent |
|
312 | 312 | |
313 | 313 | $detectmobile = new Mobile_Detect(null, $user_agent); |
314 | 314 | $tablet = $detectmobile->isTablet(); |
@@ -800,13 +800,13 @@ discard block |
||
800 | 800 | // Sanitizing for special parameters. |
801 | 801 | // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. |
802 | 802 | if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') { |
803 | - $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. |
|
804 | - $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retreive it after other replacements. |
|
803 | + $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. |
|
804 | + $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retreive it after other replacements. |
|
805 | 805 | do { |
806 | 806 | $oldstringtoclean = $out; |
807 | 807 | $out = str_ireplace(array('javascript', 'vbscript', '&colon', '&#'), '', $out); |
808 | - $out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc' |
|
809 | - $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL |
|
808 | + $out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc' |
|
809 | + $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL |
|
810 | 810 | } while ($oldstringtoclean != $out); |
811 | 811 | } |
812 | 812 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | // If prefix is for session (no need to have $conf loaded) |
1009 | - global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php |
|
1009 | + global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php |
|
1010 | 1010 | $tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance |
1011 | 1011 | |
1012 | 1012 | // The recommended value (may be not defined for old versions) |
@@ -1165,10 +1165,10 @@ discard block |
||
1165 | 1165 | $tmpsavdb = null; |
1166 | 1166 | if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { |
1167 | 1167 | $tmpsavdb = $object->db; |
1168 | - unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') |
|
1168 | + unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | - $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields |
|
1171 | + $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields |
|
1172 | 1172 | |
1173 | 1173 | if (!empty($tmpsavdb)) { |
1174 | 1174 | $object->db = $tmpsavdb; |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | } elseif ($native == 2) { |
1177 | 1177 | // recommended method to have a full isolated cloned object |
1178 | 1178 | $myclone = new stdClass(); |
1179 | - $tmparray = get_object_vars($object); // return only public properties |
|
1179 | + $tmparray = get_object_vars($object); // return only public properties |
|
1180 | 1180 | |
1181 | 1181 | if (is_array($tmparray)) { |
1182 | 1182 | foreach ($tmparray as $propertykey => $propertyval) { |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | { |
1314 | 1314 | do { |
1315 | 1315 | $oldstringtoclean = $stringtoclean; |
1316 | - $stringtoclean = str_ireplace(array('"', ':', '[', ']',"\n", "\r", '\\', '\/'), '', $stringtoclean); |
|
1316 | + $stringtoclean = str_ireplace(array('"', ':', '[', ']', "\n", "\r", '\\', '\/'), '', $stringtoclean); |
|
1317 | 1317 | } while ($oldstringtoclean != $stringtoclean); |
1318 | 1318 | |
1319 | 1319 | return $stringtoclean; |
@@ -1811,10 +1811,10 @@ discard block |
||
1811 | 1811 | returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text(); |
1812 | 1812 | console.log("popup has been closed. returnedid (js var defined into parent page)="+returnedid+" returnedlabel="+returnedlabel); |
1813 | 1813 | if (returnedid != "" && returnedid != "div for returned id") { |
1814 | - jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid); |
|
1814 | + jQuery("#'.(empty($backtopagejsfieldsid) ? "none" : $backtopagejsfieldsid).'").val(returnedid); |
|
1815 | 1815 | } |
1816 | 1816 | if (returnedlabel != "" && returnedlabel != "div for returned label") { |
1817 | - jQuery("#'.(empty($backtopagejsfieldslabel)?"none":$backtopagejsfieldslabel).'").val(returnedlabel); |
|
1817 | + jQuery("#'.(empty($backtopagejsfieldslabel) ? "none" : $backtopagejsfieldslabel).'").val(returnedlabel); |
|
1818 | 1818 | } |
1819 | 1819 | } |
1820 | 1820 | }); |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | } |
1952 | 1952 | } elseif (!empty($links[$i][1])) { |
1953 | 1953 | //print "x $i $active ".$links[$i][2]." z"; |
1954 | - $out .= '<div class="tab tab'.($isactive?'active':'unactive').'" style="margin: 0 !important">'; |
|
1954 | + $out .= '<div class="tab tab'.($isactive ? 'active' : 'unactive').'" style="margin: 0 !important">'; |
|
1955 | 1955 | if (!empty($links[$i][0])) { |
1956 | 1956 | $titletoshow = preg_replace('/<.*$/', '', $links[$i][1]); |
1957 | 1957 | $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tab inline-block valignmiddle'.($morecss ? ' '.$morecss : '').(!empty($links[$i][5]) ? ' '.$links[$i][5] : '').'" href="'.$links[$i][0].'" title="'.dol_escape_htmltag($titletoshow).'">'; |
@@ -2365,7 +2365,7 @@ discard block |
||
2365 | 2365 | $morehtmlref .= '</div>'; |
2366 | 2366 | } |
2367 | 2367 | |
2368 | - $parameters=array('morehtmlref'=>$morehtmlref); |
|
2368 | + $parameters = array('morehtmlref'=>$morehtmlref); |
|
2369 | 2369 | $reshook = $hookmanager->executeHooks('formDolBanner', $parameters, $object, $action); |
2370 | 2370 | if ($reshook < 0) { |
2371 | 2371 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
@@ -2455,7 +2455,7 @@ discard block |
||
2455 | 2455 | $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); |
2456 | 2456 | $ret .= (($ret && $town) ? $sep : '').$town; |
2457 | 2457 | |
2458 | - if (!empty($object->state)) { |
|
2458 | + if (!empty($object->state)) { |
|
2459 | 2459 | $ret .= ($ret ? ($town ? ", " : $sep) : '').$object->state; |
2460 | 2460 | } |
2461 | 2461 | if (!empty($object->zip)) { |
@@ -2507,7 +2507,7 @@ discard block |
||
2507 | 2507 | $ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code))); |
2508 | 2508 | } |
2509 | 2509 | if ($hookmanager) { |
2510 | - $parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode); |
|
2510 | + $parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs, 'mode' => $mode, 'extralangcode' => $extralangcode); |
|
2511 | 2511 | $reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object); |
2512 | 2512 | if ($reshook > 0) { |
2513 | 2513 | $ret = ''; |
@@ -2580,8 +2580,8 @@ discard block |
||
2580 | 2580 | if ($tzoutput == 'tzserver') { |
2581 | 2581 | $to_gmt = false; |
2582 | 2582 | $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
2583 | - $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0 |
|
2584 | - $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0 |
|
2583 | + $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0 |
|
2584 | + $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0 |
|
2585 | 2585 | } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { |
2586 | 2586 | $to_gmt = true; |
2587 | 2587 | $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' |
@@ -2591,7 +2591,7 @@ discard block |
||
2591 | 2591 | $user_dt = new DateTime(); |
2592 | 2592 | $user_dt->setTimezone($user_date_tz); |
2593 | 2593 | $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time); |
2594 | - $offsettz = $user_dt->getOffset(); // should include dst ? |
|
2594 | + $offsettz = $user_dt->getOffset(); // should include dst ? |
|
2595 | 2595 | } else { // with old method (The 'tzuser' was processed like the 'tzuserrel') |
2596 | 2596 | $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
2597 | 2597 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore |
@@ -2608,8 +2608,8 @@ discard block |
||
2608 | 2608 | |
2609 | 2609 | // Do we have to reduce the length of date (year on 2 chars) to save space. |
2610 | 2610 | // Note: dayinputnoreduce is same than day but no reduction of year length will be done |
2611 | - $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param. |
|
2612 | - $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day |
|
2611 | + $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param. |
|
2612 | + $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day |
|
2613 | 2613 | $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); |
2614 | 2614 | if ($formatwithoutreduce != $format) { |
2615 | 2615 | $format = $formatwithoutreduce; |
@@ -2693,9 +2693,9 @@ discard block |
||
2693 | 2693 | $time = dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true); |
2694 | 2694 | |
2695 | 2695 | if ($to_gmt) { |
2696 | - $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2696 | + $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2697 | 2697 | } else { |
2698 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2698 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2699 | 2699 | } |
2700 | 2700 | $dtts = new DateTime(); |
2701 | 2701 | $dtts->setTimestamp($time); |
@@ -2716,9 +2716,9 @@ discard block |
||
2716 | 2716 | $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring. |
2717 | 2717 | |
2718 | 2718 | if ($to_gmt) { |
2719 | - $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2719 | + $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2720 | 2720 | } else { |
2721 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2721 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2722 | 2722 | } |
2723 | 2723 | $dtts = new DateTime(); |
2724 | 2724 | $dtts->setTimestamp($timetouse); |
@@ -2743,9 +2743,9 @@ discard block |
||
2743 | 2743 | $timetouse = $time + $offsettz + $offsetdst; // TODO We could be able to disable use of offsettz and offsetdst to use only offsettzstring. |
2744 | 2744 | |
2745 | 2745 | if ($to_gmt) { |
2746 | - $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2746 | + $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
|
2747 | 2747 | } else { |
2748 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2748 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
2749 | 2749 | } |
2750 | 2750 | $dtts = new DateTime(); |
2751 | 2751 | $dtts->setTimestamp($timetouse); |
@@ -3133,7 +3133,7 @@ discard block |
||
3133 | 3133 | $socialnetworks = array(); |
3134 | 3134 | // Enable caching of array |
3135 | 3135 | require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; |
3136 | - $cachekey = 'socialnetworks_' . $conf->entity; |
|
3136 | + $cachekey = 'socialnetworks_'.$conf->entity; |
|
3137 | 3137 | $dataretrieved = dol_getcache($cachekey); |
3138 | 3138 | if (!is_null($dataretrieved)) { |
3139 | 3139 | $socialnetworks = $dataretrieved; |
@@ -3517,7 +3517,7 @@ discard block |
||
3517 | 3517 | $newphonesav = $newphone; |
3518 | 3518 | if (empty($conf->global->CLICKTODIAL_DO_NOT_USE_AJAX_CALL)) { |
3519 | 3519 | // Default and recommended: New method using ajax without submiting a page making a javascript history.go(-1) back |
3520 | - $newphone = '<a href="'.$url.'" class="cssforclicktodial"'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial' |
|
3520 | + $newphone = '<a href="'.$url.'" class="cssforclicktodial"'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial' |
|
3521 | 3521 | $newphone .= '>'.$newphonesav.'</a>'; |
3522 | 3522 | } else { |
3523 | 3523 | // Old method |
@@ -3537,7 +3537,7 @@ discard block |
||
3537 | 3537 | $type = 'AC_FAX'; |
3538 | 3538 | } |
3539 | 3539 | if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) { |
3540 | - $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='. urlencode($_SERVER['REQUEST_URI']) .'&actioncode='.$type.($cid ? '&contactid='.$cid : '').($socid ? '&socid='.$socid : '').'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
3540 | + $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['REQUEST_URI']).'&actioncode='.$type.($cid ? '&contactid='.$cid : '').($socid ? '&socid='.$socid : '').'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
3541 | 3541 | } |
3542 | 3542 | if ($link) { |
3543 | 3543 | $newphone = '<div>'.$newphone.' '.$link.'</div>'; |
@@ -3630,9 +3630,9 @@ discard block |
||
3630 | 3630 | if (empty($_SERVER['HTTP_X_FORWARDED_FOR']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_X_FORWARDED_FOR'])) { |
3631 | 3631 | if (empty($_SERVER['HTTP_CLIENT_IP']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_CLIENT_IP'])) { |
3632 | 3632 | if (empty($_SERVER["HTTP_CF_CONNECTING_IP"])) { |
3633 | - $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been the IP of the proxy and not the client |
|
3633 | + $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been the IP of the proxy and not the client |
|
3634 | 3634 | } else { |
3635 | - $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client |
|
3635 | + $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client |
|
3636 | 3636 | } |
3637 | 3637 | } else { |
3638 | 3638 | $ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here but may have been forged by proxy |
@@ -4113,7 +4113,7 @@ discard block |
||
4113 | 4113 | 'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced', |
4114 | 4114 | 'technic', 'ticket', |
4115 | 4115 | 'error', 'warning', |
4116 | - 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring','rss', |
|
4116 | + 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring', 'rss', |
|
4117 | 4117 | 'shapes', 'skill', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', |
4118 | 4118 | 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', |
4119 | 4119 | 'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', |
@@ -4157,7 +4157,7 @@ discard block |
||
4157 | 4157 | 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', |
4158 | 4158 | 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', |
4159 | 4159 | 'other'=>'square', |
4160 | - 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', |
|
4160 | + 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', |
|
4161 | 4161 | 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', |
4162 | 4162 | 'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', |
4163 | 4163 | 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', |
@@ -4227,7 +4227,7 @@ discard block |
||
4227 | 4227 | 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande', |
4228 | 4228 | 'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project', |
4229 | 4229 | 'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat', |
4230 | - 'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier', |
|
4230 | + 'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier', |
|
4231 | 4231 | 'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project', |
4232 | 4232 | 'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat', |
4233 | 4233 | 'incoterm'=>'infobox-supplier_proposal', |
@@ -4239,7 +4239,7 @@ discard block |
||
4239 | 4239 | 'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande', |
4240 | 4240 | 'knowledgemanagement'=>'infobox-contrat rotate90', 'loan'=>'infobox-bank_account', |
4241 | 4241 | 'payment'=>'infobox-bank_account', 'payment_vat'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', |
4242 | - 'propal'=>'infobox-propal', 'proposal'=>'infobox-propal','private'=>'infobox-project', |
|
4242 | + 'propal'=>'infobox-propal', 'proposal'=>'infobox-propal', 'private'=>'infobox-project', |
|
4243 | 4243 | 'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent', |
4244 | 4244 | 'resource'=>'infobox-action', |
4245 | 4245 | 'salary'=>'infobox-bank_account', 'shipment'=>'infobox-commande', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', |
@@ -5882,7 +5882,7 @@ discard block |
||
5882 | 5882 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
5883 | 5883 | $amount = str_replace($dec, '.', $amount); |
5884 | 5884 | |
5885 | - $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
5885 | + $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
5886 | 5886 | } |
5887 | 5887 | //print ' XX'.$amount.' '.$rounding; |
5888 | 5888 | |
@@ -5896,9 +5896,9 @@ discard block |
||
5896 | 5896 | } elseif ($rounding == 'MS') { |
5897 | 5897 | $nbofdectoround = isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? $conf->global->MAIN_MAX_DECIMALS_STOCK : 5; |
5898 | 5898 | } elseif ($rounding == 'CU') { |
5899 | - $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency |
|
5899 | + $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency |
|
5900 | 5900 | } elseif ($rounding == 'CT') { |
5901 | - $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency |
|
5901 | + $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency |
|
5902 | 5902 | } elseif (is_numeric($rounding)) { |
5903 | 5903 | $nbofdectoround = (int) $rounding; |
5904 | 5904 | } |
@@ -5932,7 +5932,7 @@ discard block |
||
5932 | 5932 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
5933 | 5933 | $amount = str_replace($dec, '.', $amount); |
5934 | 5934 | |
5935 | - $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
5935 | + $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
5936 | 5936 | } |
5937 | 5937 | |
5938 | 5938 | return $amount; |
@@ -6348,7 +6348,7 @@ discard block |
||
6348 | 6348 | } |
6349 | 6349 | } |
6350 | 6350 | if (!$found) { |
6351 | - $ret = $product->tva_tx; // Default sales vat of product |
|
6351 | + $ret = $product->tva_tx; // Default sales vat of product |
|
6352 | 6352 | if ($product->default_vat_code) { |
6353 | 6353 | $ret .= ' ('.$product->default_vat_code.')'; |
6354 | 6354 | } |
@@ -6929,7 +6929,7 @@ discard block |
||
6929 | 6929 | $tempbis = $temp; |
6930 | 6930 | do { |
6931 | 6931 | $temp = $tempbis; |
6932 | - $tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning |
|
6932 | + $tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning |
|
6933 | 6933 | $tempbis = preg_replace($pattern, '', $tempbis); |
6934 | 6934 | //$idowhile++; print $temp.'-'.$tempbis."\n"; if ($idowhile > 100) break; |
6935 | 6935 | } while ($tempbis != $temp); |
@@ -6981,7 +6981,7 @@ discard block |
||
6981 | 6981 | "ol", "p", "q", "s", "section", "span", "strike", "strong", "title", "table", "tr", "th", "td", "u", "ul", "sup", "sub", "blockquote", "pre", "h1", "h2", "h3", "h4", "h5", "h6" |
6982 | 6982 | ); |
6983 | 6983 | } |
6984 | - $allowed_tags[] = "comment"; // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment> |
|
6984 | + $allowed_tags[] = "comment"; // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment> |
|
6985 | 6985 | if ($allowiframe) { |
6986 | 6986 | $allowed_tags[] = "iframe"; |
6987 | 6987 | } |
@@ -6989,7 +6989,7 @@ discard block |
||
6989 | 6989 | $allowed_tags_string = join("><", $allowed_tags); |
6990 | 6990 | $allowed_tags_string = '<'.$allowed_tags_string.'>'; |
6991 | 6991 | |
6992 | - $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags |
|
6992 | + $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags |
|
6993 | 6993 | |
6994 | 6994 | $stringtoclean = dol_string_nounprintableascii($stringtoclean, 0); |
6995 | 6995 | |
@@ -6999,7 +6999,7 @@ discard block |
||
6999 | 6999 | $stringtoclean = preg_replace('/:/i', ':', $stringtoclean); |
7000 | 7000 | $stringtoclean = preg_replace('/:|�+58|:/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...' |
7001 | 7001 | |
7002 | - $temp = strip_tags($stringtoclean, $allowed_tags_string); // Warning: This remove also undesired </>, so may changes string obfuscated with </> that pass the injection detection into a harmfull string |
|
7002 | + $temp = strip_tags($stringtoclean, $allowed_tags_string); // Warning: This remove also undesired </>, so may changes string obfuscated with </> that pass the injection detection into a harmfull string |
|
7003 | 7003 | |
7004 | 7004 | if ($cleanalsosomestyles) { // Clean for remaining html tags |
7005 | 7005 | $temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless |
@@ -7014,9 +7014,9 @@ discard block |
||
7014 | 7014 | $temp = preg_replace('/j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:/i', '', $temp); |
7015 | 7015 | } |
7016 | 7016 | |
7017 | - $temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE |
|
7017 | + $temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE |
|
7018 | 7018 | |
7019 | - $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments |
|
7019 | + $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments |
|
7020 | 7020 | |
7021 | 7021 | |
7022 | 7022 | return $temp; |
@@ -7040,14 +7040,14 @@ discard block |
||
7040 | 7040 | $stringtoclean = '<?xml encoding="UTF-8"><html><body>'.$stringtoclean.'</body></html>'; |
7041 | 7041 | |
7042 | 7042 | $dom = new DOMDocument(null, 'UTF-8'); |
7043 | - $dom->loadHTML($stringtoclean, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); |
|
7043 | + $dom->loadHTML($stringtoclean, LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOXMLDECL); |
|
7044 | 7044 | |
7045 | 7045 | if (is_object($dom)) { |
7046 | 7046 | for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) { |
7047 | 7047 | for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) { |
7048 | 7048 | //var_dump($attrs->item($ii)); |
7049 | 7049 | if (!empty($attrs->item($ii)->name)) { |
7050 | - if (! in_array($attrs->item($ii)->name, $allowed_attributes)) { |
|
7050 | + if (!in_array($attrs->item($ii)->name, $allowed_attributes)) { |
|
7051 | 7051 | // Delete attribute if not into allowed_attributes |
7052 | 7052 | $els->item($i)->removeAttribute($attrs->item($ii)->name); |
7053 | 7053 | } elseif (in_array($attrs->item($ii)->name, array('style'))) { |
@@ -7057,7 +7057,7 @@ discard block |
||
7057 | 7057 | if (isset($valuetoclean)) { |
7058 | 7058 | do { |
7059 | 7059 | $oldvaluetoclean = $valuetoclean; |
7060 | - $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments |
|
7060 | + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments |
|
7061 | 7061 | $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); |
7062 | 7062 | if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. |
7063 | 7063 | $valuetoclean = preg_replace('/display\s*:/mi', '', $valuetoclean); |
@@ -7228,7 +7228,7 @@ discard block |
||
7228 | 7228 | // like 'abc' that wrongly ends up without the tric into with '<p>abc</p>' |
7229 | 7229 | $out = '<div class="tricktoremove">'.$out.'</div>'; |
7230 | 7230 | |
7231 | - $dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); |
|
7231 | + $dom->loadHTML($out, LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOXMLDECL); |
|
7232 | 7232 | $out = trim($dom->saveHTML()); |
7233 | 7233 | |
7234 | 7234 | // Remove the trick added to solve pb with text without parent tag |
@@ -7251,12 +7251,12 @@ discard block |
||
7251 | 7251 | // We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace). |
7252 | 7252 | // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are |
7253 | 7253 | // using a non coventionnel way to be encoded, to not have them sanitized just after) |
7254 | - $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { |
|
7254 | + $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function($m) { |
|
7255 | 7255 | return realCharForNumericEntities($m); }, $out); |
7256 | 7256 | |
7257 | 7257 | |
7258 | 7258 | // Now we remove all remaining HTML entities starting with a number. We don't want such entities. |
7259 | - $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. |
|
7259 | + $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. |
|
7260 | 7260 | |
7261 | 7261 | // Keep only some html tags and remove also some 'javascript:' strings |
7262 | 7262 | $out = dol_string_onlythesehtmltags($out, 0, 1, 1); |
@@ -7350,7 +7350,7 @@ discard block |
||
7350 | 7350 | */ |
7351 | 7351 | function dol_htmlcleanlastbr($stringtodecode) |
7352 | 7352 | { |
7353 | - $ret = preg_replace('/ $/i', "", $stringtodecode); // Because wysiwyg editor may add a at end of last line |
|
7353 | + $ret = preg_replace('/ $/i', "", $stringtodecode); // Because wysiwyg editor may add a at end of last line |
|
7354 | 7354 | $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|'."\n".'|'."\r".')+$/i', "", $ret); |
7355 | 7355 | return $ret; |
7356 | 7356 | } |
@@ -7387,7 +7387,7 @@ discard block |
||
7387 | 7387 | * @param bool $double_encode When double_encode is turned off, PHP will not encode existing html entities |
7388 | 7388 | * @return string $ret Encoded string |
7389 | 7389 | */ |
7390 | -function dol_htmlentities($string, $flags = ENT_QUOTES|ENT_SUBSTITUTE, $encoding = 'UTF-8', $double_encode = false) |
|
7390 | +function dol_htmlentities($string, $flags = ENT_QUOTES | ENT_SUBSTITUTE, $encoding = 'UTF-8', $double_encode = false) |
|
7391 | 7391 | { |
7392 | 7392 | return htmlentities($string, $flags, $encoding, $double_encode); |
7393 | 7393 | } |
@@ -7639,7 +7639,7 @@ discard block |
||
7639 | 7639 | '__MYCOMPANY_PROFID5__' => $mysoc->idprof5, |
7640 | 7640 | '__MYCOMPANY_PROFID6__' => $mysoc->idprof6, |
7641 | 7641 | '__MYCOMPANY_CAPITAL__' => $mysoc->capital, |
7642 | - '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass |
|
7642 | + '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass |
|
7643 | 7643 | '__MYCOMPANY_ADDRESS__' => $mysoc->address, |
7644 | 7644 | '__MYCOMPANY_ZIP__' => $mysoc->zip, |
7645 | 7645 | '__MYCOMPANY_TOWN__' => $mysoc->town, |
@@ -8084,9 +8084,9 @@ discard block |
||
8084 | 8084 | |
8085 | 8085 | $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : ''; |
8086 | 8086 | |
8087 | - $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; |
|
8088 | - $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; |
|
8089 | - $substitutionarray['__AMOUNT_VAT_TEXTCURRENCY__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, $conf->currency, true) : dol_convertToWord($object->total_tva, $outputlangs, $conf->currency, true)) : ''; |
|
8087 | + $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; |
|
8088 | + $substitutionarray['__AMOUNT_VAT_TEXT__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, '', true) : dol_convertToWord($object->total_tva, $outputlangs, '', true)) : ''; |
|
8089 | + $substitutionarray['__AMOUNT_VAT_TEXTCURRENCY__'] = is_object($object) ? (isset($object->total_vat) ? dol_convertToWord($object->total_vat, $outputlangs, $conf->currency, true) : dol_convertToWord($object->total_tva, $outputlangs, $conf->currency, true)) : ''; |
|
8090 | 8090 | |
8091 | 8091 | if ($onlykey != 2 || $mysoc->useLocalTax(1)) { |
8092 | 8092 | $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; |
@@ -8218,7 +8218,7 @@ discard block |
||
8218 | 8218 | // convert $newval into HTML is necessary |
8219 | 8219 | $text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $msgishtml ? dol_htmlentitiesbr($value) : $value, $text); |
8220 | 8220 | } else { |
8221 | - if (! $msgishtml) { |
|
8221 | + if (!$msgishtml) { |
|
8222 | 8222 | $valueishtml = dol_textishtml($value, 1); |
8223 | 8223 | //var_dump("valueishtml=".$valueishtml); |
8224 | 8224 | |
@@ -8250,7 +8250,7 @@ discard block |
||
8250 | 8250 | // convert $newval into HTML is necessary |
8251 | 8251 | $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ? dol_htmlentitiesbr($value) : $value, $text); |
8252 | 8252 | } else { |
8253 | - if (! $msgishtml) { |
|
8253 | + if (!$msgishtml) { |
|
8254 | 8254 | $valueishtml = dol_textishtml($value, 1); |
8255 | 8255 | |
8256 | 8256 | if ($valueishtml) { |
@@ -8278,7 +8278,7 @@ discard block |
||
8278 | 8278 | if (empty($converttextinhtmlifnecessary)) { |
8279 | 8279 | $text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example |
8280 | 8280 | } else { |
8281 | - if (! $msgishtml) { |
|
8281 | + if (!$msgishtml) { |
|
8282 | 8282 | $valueishtml = dol_textishtml($value, 1); |
8283 | 8283 | |
8284 | 8284 | if ($valueishtml) { |
@@ -8748,7 +8748,7 @@ discard block |
||
8748 | 8748 | $temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index]; |
8749 | 8749 | } |
8750 | 8750 | if ($natsort == -1) { |
8751 | - $temp[$key] = '___'.$temp[$key]; // We add a string at begin of value to force an alpha order when using asort. |
|
8751 | + $temp[$key] = '___'.$temp[$key]; // We add a string at begin of value to force an alpha order when using asort. |
|
8752 | 8752 | } |
8753 | 8753 | } |
8754 | 8754 | |
@@ -8762,7 +8762,7 @@ discard block |
||
8762 | 8762 | if ($case_sensitive) { |
8763 | 8763 | natsort($temp); |
8764 | 8764 | } else { |
8765 | - natcasesort($temp); // natecasesort is not sensible to case |
|
8765 | + natcasesort($temp); // natecasesort is not sensible to case |
|
8766 | 8766 | } |
8767 | 8767 | if ($order != 'asc') { |
8768 | 8768 | $temp = array_reverse($temp, true); |
@@ -8790,7 +8790,7 @@ discard block |
||
8790 | 8790 | */ |
8791 | 8791 | function utf8_check($str) |
8792 | 8792 | { |
8793 | - $str = (string) $str; // Sometimes string is an int. |
|
8793 | + $str = (string) $str; // Sometimes string is an int. |
|
8794 | 8794 | |
8795 | 8795 | // We must use here a binary strlen function (so not dol_strlen) |
8796 | 8796 | $strLength = dol_strlen($str); |
@@ -9069,7 +9069,7 @@ discard block |
||
9069 | 9069 | } |
9070 | 9070 | } catch (Error $e) { |
9071 | 9071 | $error = 'Caught error : '; |
9072 | - $error .= $e->getMessage() . ', '; |
|
9072 | + $error .= $e->getMessage().', '; |
|
9073 | 9073 | $error .= 'Trace : '; |
9074 | 9074 | $error .= json_encode($e->getTrace()); |
9075 | 9075 | error_log($error, 1); |
@@ -9212,8 +9212,8 @@ discard block |
||
9212 | 9212 | 'en-GB', |
9213 | 9213 | 'en-IE', |
9214 | 9214 | 'en-IN', |
9215 | - 'as-IN', // as-IN must be after en-IN (en in priority if country is IN) |
|
9216 | - 'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN) |
|
9215 | + 'as-IN', // as-IN must be after en-IN (en in priority if country is IN) |
|
9216 | + 'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN) |
|
9217 | 9217 | 'en-JM', |
9218 | 9218 | 'en-MY', |
9219 | 9219 | 'en-NZ', |
@@ -9641,7 +9641,7 @@ discard block |
||
9641 | 9641 | print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'0\']").prop(\'value\', \'\');'."\n"; |
9642 | 9642 | |
9643 | 9643 | // Add 'field required' class on closest td for all input elements : input, textarea and select |
9644 | - print 'jQuery(":input[name=\'' . $paramkey . '\']").closest("tr").find("td:first").addClass("fieldrequired");' . "\n"; |
|
9644 | + print 'jQuery(":input[name=\''.$paramkey.'\']").closest("tr").find("td:first").addClass("fieldrequired");'."\n"; |
|
9645 | 9645 | } |
9646 | 9646 | } |
9647 | 9647 | } |
@@ -9777,7 +9777,7 @@ discard block |
||
9777 | 9777 | if (!function_exists('getmypid')) { |
9778 | 9778 | return mt_rand(99900000, 99965535); |
9779 | 9779 | } else { |
9780 | - return getmypid(); // May be a number on 64 bits (depending on OS) |
|
9780 | + return getmypid(); // May be a number on 64 bits (depending on OS) |
|
9781 | 9781 | } |
9782 | 9782 | } |
9783 | 9783 | |
@@ -10521,7 +10521,7 @@ discard block |
||
10521 | 10521 | { |
10522 | 10522 | global $conf, $db; |
10523 | 10523 | |
10524 | - $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); // Clean name of table for backward compatibility. |
|
10524 | + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); // Clean name of table for backward compatibility. |
|
10525 | 10525 | |
10526 | 10526 | $dictvalues = (isset($conf->cache['dictvalues_'.$tablename]) ? $conf->cache['dictvalues_'.$tablename] : null); |
10527 | 10527 | |
@@ -10536,7 +10536,7 @@ discard block |
||
10536 | 10536 | $resql = $db->query($sql); |
10537 | 10537 | if ($resql) { |
10538 | 10538 | while ($obj = $db->fetch_object($resql)) { |
10539 | - $dictvalues[$obj->{$rowidfield}] = $obj; // $obj is stdClass |
|
10539 | + $dictvalues[$obj->{$rowidfield}] = $obj; // $obj is stdClass |
|
10540 | 10540 | } |
10541 | 10541 | } else { |
10542 | 10542 | dol_print_error($db); |
@@ -10883,7 +10883,7 @@ discard block |
||
10883 | 10883 | |
10884 | 10884 | // automatic add tooltip when title is detected |
10885 | 10885 | if (!empty($attr['title']) && !empty($attr['class']) && strpos($attr['class'], 'classfortooltip') === false) { |
10886 | - $attr['class'].= ' classfortooltip'; |
|
10886 | + $attr['class'] .= ' classfortooltip'; |
|
10887 | 10887 | } |
10888 | 10888 | |
10889 | 10889 | // Js Confirm button |
@@ -10893,7 +10893,7 @@ discard block |
||
10893 | 10893 | } |
10894 | 10894 | |
10895 | 10895 | if (empty($params['confirm']['url'])) { |
10896 | - $params['confirm']['url'] = $url . (strpos($url, '?') > 0 ? '&' : '?') . 'confirm=yes'; |
|
10896 | + $params['confirm']['url'] = $url.(strpos($url, '?') > 0 ? '&' : '?').'confirm=yes'; |
|
10897 | 10897 | } |
10898 | 10898 | |
10899 | 10899 | // for js desabled compatibility set $url as call to confirm action and $params['confirm']['url'] to confirmed action |
@@ -10905,7 +10905,7 @@ discard block |
||
10905 | 10905 | $attr['data-confirm-cancel-btn-label'] = !empty($params['confirm']['cancel-btn-label']) ? $params['confirm']['cancel-btn-label'] : $langs->trans('CloseDialog'); |
10906 | 10906 | $attr['data-confirm-modal'] = !empty($params['confirm']['modal']) ? $params['confirm']['modal'] : true; |
10907 | 10907 | |
10908 | - $attr['class'].= ' butActionConfirm'; |
|
10908 | + $attr['class'] .= ' butActionConfirm'; |
|
10909 | 10909 | } |
10910 | 10910 | |
10911 | 10911 | if (isset($attr['href']) && empty($attr['href'])) { |
@@ -10926,8 +10926,8 @@ discard block |
||
10926 | 10926 | |
10927 | 10927 | |
10928 | 10928 | $parameters = array( |
10929 | - 'TCompiledAttr' => $TCompiledAttr, // array |
|
10930 | - 'compiledAttributes' => $compiledAttributes, // string |
|
10929 | + 'TCompiledAttr' => $TCompiledAttr, // array |
|
10930 | + 'compiledAttributes' => $compiledAttributes, // string |
|
10931 | 10931 | 'attr' => $attr, |
10932 | 10932 | 'tag' => $tag, |
10933 | 10933 | 'label' => $label, |
@@ -10944,9 +10944,9 @@ discard block |
||
10944 | 10944 | |
10945 | 10945 | if (empty($reshook)) { |
10946 | 10946 | if (dol_textishtml($text)) { // If content already HTML encoded |
10947 | - return '<' . $tag . ' ' . $compiledAttributes . '>' . $text . '</' . $tag . '>'; |
|
10947 | + return '<'.$tag.' '.$compiledAttributes.'>'.$text.'</'.$tag.'>'; |
|
10948 | 10948 | } else { |
10949 | - return '<' . $tag . ' ' . $compiledAttributes . '>' . dol_escape_htmltag($text) . '</' . $tag . '>'; |
|
10949 | + return '<'.$tag.' '.$compiledAttributes.'>'.dol_escape_htmltag($text).'</'.$tag.'>'; |
|
10950 | 10950 | } |
10951 | 10951 | } else { |
10952 | 10952 | return $hookmanager->resPrint; |
@@ -10974,9 +10974,9 @@ discard block |
||
10974 | 10974 | { |
10975 | 10975 | $out = ''; |
10976 | 10976 | if (!empty($fieldValidationErrorMsg)) { |
10977 | - $out.= '<span class="field-error-icon classfortooltip" title="'.dol_escape_htmltag($fieldValidationErrorMsg, 1).'" role="alert" >'; // role alert is used for accessibility |
|
10978 | - $out.= '<span class="fa fa-exclamation-circle" aria-hidden="true" ></span>'; // For accessibility icon is separated and aria-hidden |
|
10979 | - $out.= '</span>'; |
|
10977 | + $out .= '<span class="field-error-icon classfortooltip" title="'.dol_escape_htmltag($fieldValidationErrorMsg, 1).'" role="alert" >'; // role alert is used for accessibility |
|
10978 | + $out .= '<span class="fa fa-exclamation-circle" aria-hidden="true" ></span>'; // For accessibility icon is separated and aria-hidden |
|
10979 | + $out .= '</span>'; |
|
10980 | 10980 | } |
10981 | 10981 | |
10982 | 10982 | return $out; |
@@ -11485,7 +11485,7 @@ discard block |
||
11485 | 11485 | $showonlyonhover = 0; |
11486 | 11486 | }*/ |
11487 | 11487 | |
11488 | - $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. |
|
11488 | + $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. |
|
11489 | 11489 | if ($texttoshow === 'none') { |
11490 | 11490 | $result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).'</'.$tag.'><span class="clipboardCPValueToPrint"></span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText"></span></span>'; |
11491 | 11491 | } elseif ($texttoshow) { |
@@ -12333,9 +12333,9 @@ discard block |
||
12333 | 12333 | function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') |
12334 | 12334 | { |
12335 | 12335 | if ($hourTime === 'getpost') { |
12336 | - $hour = GETPOSTINT($prefix . 'hour'); |
|
12337 | - $minute = GETPOSTINT($prefix . 'minute'); |
|
12338 | - $second = GETPOSTINT($prefix . 'second'); |
|
12336 | + $hour = GETPOSTINT($prefix.'hour'); |
|
12337 | + $minute = GETPOSTINT($prefix.'minute'); |
|
12338 | + $second = GETPOSTINT($prefix.'second'); |
|
12339 | 12339 | } elseif (preg_match('/^(\d\d):(\d\d):(\d\d)$/', $hourTime, $m)) { |
12340 | 12340 | $hour = intval($m[1]); |
12341 | 12341 | $minute = intval($m[2]); |
@@ -12347,7 +12347,7 @@ discard block |
||
12347 | 12347 | $hour = min($hour, 23); |
12348 | 12348 | $minute = min($minute, 59); |
12349 | 12349 | $second = min($second, 59); |
12350 | - return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); |
|
12350 | + return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix.'month'), GETPOSTINT($prefix.'day'), GETPOSTINT($prefix.'year'), $gm); |
|
12351 | 12351 | } |
12352 | 12352 | |
12353 | 12353 | /** |
@@ -12365,17 +12365,17 @@ discard block |
||
12365 | 12365 | { |
12366 | 12366 | if ($timestamp === null) $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); |
12367 | 12367 | $TParam = array( |
12368 | - $prefix . 'day' => intval(dol_print_date($timestamp, '%d')), |
|
12369 | - $prefix . 'month' => intval(dol_print_date($timestamp, '%m')), |
|
12370 | - $prefix . 'year' => intval(dol_print_date($timestamp, '%Y')), |
|
12368 | + $prefix.'day' => intval(dol_print_date($timestamp, '%d')), |
|
12369 | + $prefix.'month' => intval(dol_print_date($timestamp, '%m')), |
|
12370 | + $prefix.'year' => intval(dol_print_date($timestamp, '%Y')), |
|
12371 | 12371 | ); |
12372 | 12372 | if ($hourTime === 'getpost' || ($timestamp !== null && dol_print_date($timestamp, '%H:%M:%S') !== '00:00:00')) { |
12373 | 12373 | $TParam = array_merge($TParam, array( |
12374 | - $prefix . 'hour' => intval(dol_print_date($timestamp, '%H')), |
|
12375 | - $prefix . 'minute' => intval(dol_print_date($timestamp, '%M')), |
|
12376 | - $prefix . 'second' => intval(dol_print_date($timestamp, '%S')) |
|
12374 | + $prefix.'hour' => intval(dol_print_date($timestamp, '%H')), |
|
12375 | + $prefix.'minute' => intval(dol_print_date($timestamp, '%M')), |
|
12376 | + $prefix.'second' => intval(dol_print_date($timestamp, '%S')) |
|
12377 | 12377 | )); |
12378 | 12378 | } |
12379 | 12379 | |
12380 | - return '&' . http_build_query($TParam); |
|
12380 | + return '&'.http_build_query($TParam); |
|
12381 | 12381 | } |
@@ -701,15 +701,15 @@ discard block |
||
701 | 701 | } |
702 | 702 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
703 | 703 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
704 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
704 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
705 | 705 | } else { |
706 | - $value = $this->array_options['options_' . $key]; |
|
707 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
706 | + $value = $this->array_options['options_'.$key]; |
|
707 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
708 | 708 | } |
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
712 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
712 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
713 | 713 | $parameters = array( |
714 | 714 | 'tooltipcontentarray' => &$datas |
715 | 715 | ); |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); |
817 | 817 | $this->firstname = dol_ucwords(dol_strtolower($this->firstname)); |
818 | 818 | $this->name = dol_ucwords(dol_strtolower($this->name)); |
819 | - $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):''; |
|
819 | + $this->name_alias = isset($this->name_alias) ?dol_ucwords(dol_strtolower($this->name_alias)) : ''; |
|
820 | 820 | } |
821 | 821 | if (!empty($conf->global->MAIN_ALL_TO_UPPER)) { |
822 | 822 | $this->lastname = dol_strtoupper($this->lastname); |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | if ($source == 'external' || $source == 'thirdparty') { |
1417 | 1417 | $sql .= " AND tc.source = 'external'"; |
1418 | 1418 | if ($status >= 0) { |
1419 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1419 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1420 | 1420 | } |
1421 | 1421 | } |
1422 | 1422 | $sql .= " AND tc.active = 1"; |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | if ($idtofetch) { |
1776 | 1776 | $thirdparty = new Societe($this->db); |
1777 | 1777 | $result = $thirdparty->fetch($idtofetch); |
1778 | - if ($result<0) { |
|
1779 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
1778 | + if ($result < 0) { |
|
1779 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
1780 | 1780 | } |
1781 | 1781 | $this->thirdparty = $thirdparty; |
1782 | 1782 | |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | } |
2178 | 2178 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
2179 | 2179 | $sql = "SELECT MAX(te.".$fieldid.")"; |
2180 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2180 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2181 | 2181 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2182 | 2182 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2183 | 2183 | } |
@@ -2247,7 +2247,7 @@ discard block |
||
2247 | 2247 | $this->ref_previous = $row[0]; |
2248 | 2248 | |
2249 | 2249 | $sql = "SELECT MIN(te.".$fieldid.")"; |
2250 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2250 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2251 | 2251 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2252 | 2252 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2253 | 2253 | } |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | // Triggers |
2402 | 2402 | if (!$error && !$notrigger) { |
2403 | 2403 | // Call triggers |
2404 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
2404 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
2405 | 2405 | if ($result < 0) { |
2406 | 2406 | $error++; |
2407 | 2407 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2754,7 +2754,7 @@ discard block |
||
2754 | 2754 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
2755 | 2755 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
2756 | 2756 | if (in_array($this->table_element, array('propal', 'commande'))) { |
2757 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2757 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2758 | 2758 | } |
2759 | 2759 | $sql .= ' WHERE rowid='.((int) $this->id); |
2760 | 2760 | |
@@ -3099,10 +3099,10 @@ discard block |
||
3099 | 3099 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
3100 | 3100 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3101 | 3101 | if (!$renum) { |
3102 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
3102 | + $sql .= " AND ".$fieldposition." = 0"; |
|
3103 | 3103 | } |
3104 | 3104 | if ($renum) { |
3105 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
3105 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
3106 | 3106 | } |
3107 | 3107 | |
3108 | 3108 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3123,7 +3123,7 @@ discard block |
||
3123 | 3123 | if ($fk_parent_line) { |
3124 | 3124 | $sql .= ' AND fk_parent_line IS NULL'; |
3125 | 3125 | } |
3126 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
3126 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
3127 | 3127 | |
3128 | 3128 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
3129 | 3129 | $resql = $this->db->query($sql); |
@@ -3174,7 +3174,7 @@ discard block |
||
3174 | 3174 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3175 | 3175 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3176 | 3176 | $sql .= ' AND fk_parent_line = '.((int) $id); |
3177 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
3177 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
3178 | 3178 | |
3179 | 3179 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
3180 | 3180 | $resql = $this->db->query($sql); |
@@ -3257,8 +3257,8 @@ discard block |
||
3257 | 3257 | dol_print_error($this->db); |
3258 | 3258 | return -1; |
3259 | 3259 | } else { |
3260 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3261 | - $action=''; |
|
3260 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3261 | + $action = ''; |
|
3262 | 3262 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
3263 | 3263 | return 1; |
3264 | 3264 | } |
@@ -3297,7 +3297,7 @@ discard block |
||
3297 | 3297 | |
3298 | 3298 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3299 | 3299 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3300 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
3300 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
3301 | 3301 | if ($this->db->query($sql)) { |
3302 | 3302 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
3303 | 3303 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3328,7 +3328,7 @@ discard block |
||
3328 | 3328 | |
3329 | 3329 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3330 | 3330 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3331 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
3331 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
3332 | 3332 | if ($this->db->query($sql)) { |
3333 | 3333 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
3334 | 3334 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3354,7 +3354,7 @@ discard block |
||
3354 | 3354 | $fieldposition = 'position'; |
3355 | 3355 | } |
3356 | 3356 | |
3357 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
3357 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
3358 | 3358 | $sql .= " WHERE rowid = ".((int) $rowid); |
3359 | 3359 | |
3360 | 3360 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3382,7 +3382,7 @@ discard block |
||
3382 | 3382 | |
3383 | 3383 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3384 | 3384 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3385 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
3385 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
3386 | 3386 | $resql = $this->db->query($sql); |
3387 | 3387 | if ($resql) { |
3388 | 3388 | $row = $this->db->fetch_row($resql); |
@@ -3499,7 +3499,7 @@ discard block |
||
3499 | 3499 | $newsuffix = ''; |
3500 | 3500 | } |
3501 | 3501 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
3502 | - $fieldusermod = "fk_user_mod"; |
|
3502 | + $fieldusermod = "fk_user_mod"; |
|
3503 | 3503 | } elseif ($this->table_element == 'ecm_files') { |
3504 | 3504 | $fieldusermod = "fk_user_m"; |
3505 | 3505 | } else { |
@@ -3862,7 +3862,7 @@ discard block |
||
3862 | 3862 | // It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target. |
3863 | 3863 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
3864 | 3864 | // Add module part to target type if object has $module property and isn't in core modules. |
3865 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3865 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3866 | 3866 | |
3867 | 3867 | $parameters = array('targettype'=>$targettype); |
3868 | 3868 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3874,19 +3874,19 @@ discard block |
||
3874 | 3874 | $this->db->begin(); |
3875 | 3875 | $error = 0; |
3876 | 3876 | |
3877 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
3877 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
3878 | 3878 | $sql .= "fk_source"; |
3879 | 3879 | $sql .= ", sourcetype"; |
3880 | 3880 | $sql .= ", fk_target"; |
3881 | 3881 | $sql .= ", targettype"; |
3882 | 3882 | $sql .= ") VALUES ("; |
3883 | 3883 | $sql .= ((int) $origin_id); |
3884 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
3885 | - $sql .= ", " . ((int) $this->id); |
|
3886 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
3884 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
3885 | + $sql .= ", ".((int) $this->id); |
|
3886 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
3887 | 3887 | $sql .= ")"; |
3888 | 3888 | |
3889 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
3889 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
3890 | 3890 | if ($this->db->query($sql)) { |
3891 | 3891 | if (!$notrigger) { |
3892 | 3892 | // Call trigger |
@@ -4192,20 +4192,20 @@ discard block |
||
4192 | 4192 | $this->db->begin(); |
4193 | 4193 | $error = 0; |
4194 | 4194 | |
4195 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
4195 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
4196 | 4196 | if ($updatesource) { |
4197 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
4198 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4199 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
4200 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4197 | + $sql .= "fk_source = ".((int) $sourceid); |
|
4198 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4199 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
4200 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
4201 | 4201 | } elseif ($updatetarget) { |
4202 | - $sql .= "fk_target = " . ((int) $targetid); |
|
4203 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
4204 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
4205 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4202 | + $sql .= "fk_target = ".((int) $targetid); |
|
4203 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
4204 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
4205 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4206 | 4206 | } |
4207 | 4207 | |
4208 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
4208 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
4209 | 4209 | if ($this->db->query($sql)) { |
4210 | 4210 | if (!$notrigger) { |
4211 | 4211 | // Call trigger |
@@ -4281,25 +4281,25 @@ discard block |
||
4281 | 4281 | } |
4282 | 4282 | |
4283 | 4283 | if (!$error) { |
4284 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
4284 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
4285 | 4285 | $sql .= " WHERE"; |
4286 | 4286 | if ($rowid > 0) { |
4287 | - $sql .= " rowid = " . ((int) $rowid); |
|
4287 | + $sql .= " rowid = ".((int) $rowid); |
|
4288 | 4288 | } else { |
4289 | 4289 | if ($deletesource) { |
4290 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4291 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4290 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4291 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
4292 | 4292 | } elseif ($deletetarget) { |
4293 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
4294 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4293 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
4294 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4295 | 4295 | } else { |
4296 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
4296 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
4297 | 4297 | $sql .= " OR"; |
4298 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
4298 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
4299 | 4299 | } |
4300 | 4300 | } |
4301 | 4301 | |
4302 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
4302 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
4303 | 4303 | if (!$this->db->query($sql)) { |
4304 | 4304 | $this->error = $this->db->lasterror(); |
4305 | 4305 | $this->errors[] = $this->error; |
@@ -4429,14 +4429,14 @@ discard block |
||
4429 | 4429 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
4430 | 4430 | } |
4431 | 4431 | $sql .= " WHERE rowid = ".((int) $elementId); |
4432 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4432 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4433 | 4433 | |
4434 | 4434 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
4435 | 4435 | $resql = $this->db->query($sql); |
4436 | 4436 | if ($resql) { |
4437 | 4437 | $error = 0; |
4438 | 4438 | |
4439 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4439 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4440 | 4440 | |
4441 | 4441 | if ($nb_rows_affected > 0) { |
4442 | 4442 | if (empty($trigkey)) { |
@@ -4603,19 +4603,19 @@ discard block |
||
4603 | 4603 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
4604 | 4604 | // Check if element can be deleted |
4605 | 4605 | $sql = "SELECT COUNT(*) as nb"; |
4606 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
4606 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
4607 | 4607 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4608 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4608 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4609 | 4609 | } |
4610 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4610 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4611 | 4611 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4612 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
4612 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
4613 | 4613 | } |
4614 | 4614 | if (!empty($entity)) { |
4615 | 4615 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4616 | - $sql.= " AND p.entity = ".((int) $entity); |
|
4616 | + $sql .= " AND p.entity = ".((int) $entity); |
|
4617 | 4617 | } else { |
4618 | - $sql.= " AND c.entity = ".((int) $entity); |
|
4618 | + $sql .= " AND c.entity = ".((int) $entity); |
|
4619 | 4619 | } |
4620 | 4620 | } |
4621 | 4621 | $resql = $this->db->query($sql); |
@@ -4628,9 +4628,9 @@ discard block |
||
4628 | 4628 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
4629 | 4629 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
4630 | 4630 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
4631 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4631 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4632 | 4632 | } else { // new usage: $element['name']=Translation key |
4633 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4633 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4634 | 4634 | } |
4635 | 4635 | break; // We found at least one, we stop here |
4636 | 4636 | } |
@@ -4689,7 +4689,7 @@ discard block |
||
4689 | 4689 | */ |
4690 | 4690 | public function getTotalDiscount() |
4691 | 4691 | { |
4692 | - if (!empty($this->table_element_line) ) { |
|
4692 | + if (!empty($this->table_element_line)) { |
|
4693 | 4693 | $total_discount = 0.00; |
4694 | 4694 | |
4695 | 4695 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5638,7 +5638,7 @@ discard block |
||
5638 | 5638 | $setsharekey = false; |
5639 | 5639 | if ($this->element == 'propal' || $this->element == 'proposal') { |
5640 | 5640 | if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) { |
5641 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5641 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5642 | 5642 | } |
5643 | 5643 | if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) { |
5644 | 5644 | $setsharekey = true; |
@@ -5693,7 +5693,7 @@ discard block |
||
5693 | 5693 | $ecmfile->gen_or_uploaded = 'generated'; |
5694 | 5694 | $ecmfile->description = ''; // indexed content |
5695 | 5695 | $ecmfile->keywords = ''; // keyword content |
5696 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5696 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5697 | 5697 | $ecmfile->src_object_id = $this->id; |
5698 | 5698 | |
5699 | 5699 | $result = $ecmfile->create($user); |
@@ -5824,8 +5824,8 @@ discard block |
||
5824 | 5824 | { |
5825 | 5825 | // phpcs:enable |
5826 | 5826 | global $langs, $conf; |
5827 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
5828 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
5827 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
5828 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
5829 | 5829 | exit; |
5830 | 5830 | } |
5831 | 5831 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. |
@@ -6117,8 +6117,8 @@ discard block |
||
6117 | 6117 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
6118 | 6118 | //var_dump($conf->disable_compute); |
6119 | 6119 | if (empty($conf->disable_compute)) { |
6120 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
6121 | - $objectoffield = $this; // we can use it inside computed formula |
|
6120 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
6121 | + $objectoffield = $this; // we can use it inside computed formula |
|
6122 | 6122 | $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); |
6123 | 6123 | } |
6124 | 6124 | } |
@@ -6132,7 +6132,7 @@ discard block |
||
6132 | 6132 | return 0; |
6133 | 6133 | } |
6134 | 6134 | } else { |
6135 | - $this->errors[]=$this->db->lasterror; |
|
6135 | + $this->errors[] = $this->db->lasterror; |
|
6136 | 6136 | return -1; |
6137 | 6137 | } |
6138 | 6138 | } |
@@ -6935,7 +6935,7 @@ discard block |
||
6935 | 6935 | |
6936 | 6936 | // Add validation state class |
6937 | 6937 | if (!empty($validationClass)) { |
6938 | - $morecss.= $validationClass; |
|
6938 | + $morecss .= $validationClass; |
|
6939 | 6939 | } |
6940 | 6940 | |
6941 | 6941 | if (in_array($type, array('date'))) { |
@@ -7079,8 +7079,8 @@ discard block |
||
7079 | 7079 | } |
7080 | 7080 | |
7081 | 7081 | $sqlwhere = ''; |
7082 | - $sql = "SELECT " . $keyList; |
|
7083 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
7082 | + $sql = "SELECT ".$keyList; |
|
7083 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
7084 | 7084 | if (!empty($InfoFieldList[4])) { |
7085 | 7085 | // can use SELECT request |
7086 | 7086 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7096,24 +7096,24 @@ discard block |
||
7096 | 7096 | |
7097 | 7097 | //We have to join on extrafield table |
7098 | 7098 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7099 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
7100 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7099 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
7100 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7101 | 7101 | } else { |
7102 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7102 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7103 | 7103 | } |
7104 | 7104 | } else { |
7105 | 7105 | $sqlwhere .= ' WHERE 1=1'; |
7106 | 7106 | } |
7107 | 7107 | // Some tables may have field, some other not. For the moment we disable it. |
7108 | 7108 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7109 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7109 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7110 | 7110 | } |
7111 | 7111 | $sql .= $sqlwhere; |
7112 | 7112 | //print $sql; |
7113 | 7113 | |
7114 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
7114 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
7115 | 7115 | |
7116 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
7116 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
7117 | 7117 | $resql = $this->db->query($sql); |
7118 | 7118 | if ($resql) { |
7119 | 7119 | $out .= '<option value="0"> </option>'; |
@@ -7129,7 +7129,7 @@ discard block |
||
7129 | 7129 | if (count($fields_label) > 1) { |
7130 | 7130 | $notrans = true; |
7131 | 7131 | foreach ($fields_label as $field_toshow) { |
7132 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7132 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7133 | 7133 | } |
7134 | 7134 | } else { |
7135 | 7135 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7140,12 +7140,12 @@ discard block |
||
7140 | 7140 | foreach ($fields_label as $field_toshow) { |
7141 | 7141 | $translabel = $langs->trans($obj->$field_toshow); |
7142 | 7142 | if ($translabel != $obj->$field_toshow) { |
7143 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
7143 | + $labeltoshow = dol_trunc($translabel).' '; |
|
7144 | 7144 | } else { |
7145 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
7145 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
7146 | 7146 | } |
7147 | 7147 | } |
7148 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7148 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7149 | 7149 | } else { |
7150 | 7150 | if (!$notrans) { |
7151 | 7151 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7159,34 +7159,34 @@ discard block |
||
7159 | 7159 | $labeltoshow = '(not defined)'; |
7160 | 7160 | } |
7161 | 7161 | if ($value == $obj->rowid) { |
7162 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7162 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7163 | 7163 | } |
7164 | 7164 | |
7165 | 7165 | if (!empty($InfoFieldList[3]) && $parentField) { |
7166 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7166 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7167 | 7167 | $isDependList = 1; |
7168 | 7168 | } |
7169 | 7169 | |
7170 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
7170 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
7171 | 7171 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
7172 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
7173 | - $out .= '>' . $labeltoshow . '</option>'; |
|
7172 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
7173 | + $out .= '>'.$labeltoshow.'</option>'; |
|
7174 | 7174 | } |
7175 | 7175 | |
7176 | 7176 | $i++; |
7177 | 7177 | } |
7178 | 7178 | $this->db->free($resql); |
7179 | 7179 | } else { |
7180 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7180 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7181 | 7181 | } |
7182 | 7182 | } else { |
7183 | 7183 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7184 | 7184 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7185 | 7185 | $out .= '<option value="0"> </option>'; |
7186 | 7186 | foreach ($data as $data_key => $data_value) { |
7187 | - $out .= '<option value="' . $data_key . '"'; |
|
7187 | + $out .= '<option value="'.$data_key.'"'; |
|
7188 | 7188 | $out .= ($value == $data_key ? ' selected' : ''); |
7189 | - $out .= '>' . $data_value . '</option>'; |
|
7189 | + $out .= '>'.$data_value.'</option>'; |
|
7190 | 7190 | } |
7191 | 7191 | } |
7192 | 7192 | } |
@@ -7251,8 +7251,8 @@ discard block |
||
7251 | 7251 | } |
7252 | 7252 | |
7253 | 7253 | $sqlwhere = ''; |
7254 | - $sql = "SELECT " . $keyList; |
|
7255 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
7254 | + $sql = "SELECT ".$keyList; |
|
7255 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
7256 | 7256 | if (!empty($InfoFieldList[4])) { |
7257 | 7257 | // can use SELECT request |
7258 | 7258 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7268,23 +7268,23 @@ discard block |
||
7268 | 7268 | |
7269 | 7269 | // We have to join on extrafield table |
7270 | 7270 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7271 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
7272 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7271 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
7272 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7273 | 7273 | } else { |
7274 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7274 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7275 | 7275 | } |
7276 | 7276 | } else { |
7277 | 7277 | $sqlwhere .= ' WHERE 1=1'; |
7278 | 7278 | } |
7279 | 7279 | // Some tables may have field, some other not. For the moment we disable it. |
7280 | 7280 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7281 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7281 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7282 | 7282 | } |
7283 | 7283 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
7284 | 7284 | // print $sql; |
7285 | 7285 | |
7286 | 7286 | $sql .= $sqlwhere; |
7287 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
7287 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
7288 | 7288 | $resql = $this->db->query($sql); |
7289 | 7289 | if ($resql) { |
7290 | 7290 | $num = $this->db->num_rows($resql); |
@@ -7302,7 +7302,7 @@ discard block |
||
7302 | 7302 | if (count($fields_label) > 1) { |
7303 | 7303 | $notrans = true; |
7304 | 7304 | foreach ($fields_label as $field_toshow) { |
7305 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7305 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7306 | 7306 | } |
7307 | 7307 | } else { |
7308 | 7308 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7313,9 +7313,9 @@ discard block |
||
7313 | 7313 | foreach ($fields_label as $field_toshow) { |
7314 | 7314 | $translabel = $langs->trans($obj->$field_toshow); |
7315 | 7315 | if ($translabel != $obj->$field_toshow) { |
7316 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
7316 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
7317 | 7317 | } else { |
7318 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
7318 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
7319 | 7319 | } |
7320 | 7320 | } |
7321 | 7321 | |
@@ -7338,7 +7338,7 @@ discard block |
||
7338 | 7338 | } |
7339 | 7339 | |
7340 | 7340 | if (!empty($InfoFieldList[3]) && $parentField) { |
7341 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7341 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7342 | 7342 | $isDependList = 1; |
7343 | 7343 | } |
7344 | 7344 | |
@@ -7349,14 +7349,14 @@ discard block |
||
7349 | 7349 | } |
7350 | 7350 | $this->db->free($resql); |
7351 | 7351 | |
7352 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7352 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7353 | 7353 | } else { |
7354 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7354 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7355 | 7355 | } |
7356 | 7356 | } else { |
7357 | 7357 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7358 | 7358 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7359 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7359 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7360 | 7360 | } |
7361 | 7361 | } |
7362 | 7362 | } elseif ($type == 'link') { |
@@ -7436,7 +7436,7 @@ discard block |
||
7436 | 7436 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
7437 | 7437 | } |
7438 | 7438 | |
7439 | - if ($isDependList==1) { |
|
7439 | + if ($isDependList == 1) { |
|
7440 | 7440 | $out .= $this->getJSListDependancies('_common'); |
7441 | 7441 | } |
7442 | 7442 | /* Add comments |
@@ -7474,7 +7474,7 @@ discard block |
||
7474 | 7474 | $form = new Form($this->db); |
7475 | 7475 | } |
7476 | 7476 | |
7477 | - $objectid = $this->id; // Not used ??? |
|
7477 | + $objectid = $this->id; // Not used ??? |
|
7478 | 7478 | |
7479 | 7479 | $label = empty($val['label']) ? '' : $val['label']; |
7480 | 7480 | $type = empty($val['type']) ? '' : $val['type']; |
@@ -7569,7 +7569,7 @@ discard block |
||
7569 | 7569 | $value = $this->getLibStatut(3); |
7570 | 7570 | } elseif ($type == 'date') { |
7571 | 7571 | if (!empty($value)) { |
7572 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7572 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7573 | 7573 | } else { |
7574 | 7574 | $value = ''; |
7575 | 7575 | } |
@@ -7607,7 +7607,7 @@ discard block |
||
7607 | 7607 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
7608 | 7608 | } |
7609 | 7609 | } elseif ($type == 'select') { |
7610 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
7610 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
7611 | 7611 | } elseif ($type == 'sellist') { |
7612 | 7612 | $param_list = array_keys($param['options']); |
7613 | 7613 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7667,9 +7667,9 @@ discard block |
||
7667 | 7667 | $translabel = $langs->trans($obj->$field_toshow); |
7668 | 7668 | } |
7669 | 7669 | if ($translabel != $field_toshow) { |
7670 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
7670 | + $value .= dol_trunc($translabel, 18).' '; |
|
7671 | 7671 | } else { |
7672 | - $value .= $obj->$field_toshow . ' '; |
|
7672 | + $value .= $obj->$field_toshow.' '; |
|
7673 | 7673 | } |
7674 | 7674 | } |
7675 | 7675 | } else { |
@@ -7685,7 +7685,7 @@ discard block |
||
7685 | 7685 | } |
7686 | 7686 | } |
7687 | 7687 | } else { |
7688 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7688 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7689 | 7689 | |
7690 | 7690 | $toprint = array(); |
7691 | 7691 | $obj = $this->db->fetch_object($resql); |
@@ -7693,7 +7693,7 @@ discard block |
||
7693 | 7693 | $c->fetch($obj->rowid); |
7694 | 7694 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7695 | 7695 | foreach ($ways as $way) { |
7696 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7696 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7697 | 7697 | } |
7698 | 7698 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
7699 | 7699 | } |
@@ -7764,9 +7764,9 @@ discard block |
||
7764 | 7764 | $translabel = $langs->trans($obj->$field_toshow); |
7765 | 7765 | } |
7766 | 7766 | if ($translabel != $field_toshow) { |
7767 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7767 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7768 | 7768 | } else { |
7769 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
7769 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
7770 | 7770 | } |
7771 | 7771 | } |
7772 | 7772 | } else { |
@@ -7775,15 +7775,15 @@ discard block |
||
7775 | 7775 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
7776 | 7776 | } |
7777 | 7777 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
7778 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7778 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7779 | 7779 | } else { |
7780 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
7780 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
7781 | 7781 | } |
7782 | 7782 | } |
7783 | 7783 | } |
7784 | 7784 | } |
7785 | 7785 | } else { |
7786 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7786 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7787 | 7787 | |
7788 | 7788 | $toprint = array(); |
7789 | 7789 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7792,7 +7792,7 @@ discard block |
||
7792 | 7792 | $c->fetch($obj->rowid); |
7793 | 7793 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7794 | 7794 | foreach ($ways as $way) { |
7795 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7795 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7796 | 7796 | } |
7797 | 7797 | } |
7798 | 7798 | } |
@@ -7926,7 +7926,7 @@ discard block |
||
7926 | 7926 | global $langs; |
7927 | 7927 | |
7928 | 7928 | if (!class_exists('Validate')) { |
7929 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
7929 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
7930 | 7930 | } |
7931 | 7931 | |
7932 | 7932 | $this->clearFieldError($fieldKey); |
@@ -8140,7 +8140,7 @@ discard block |
||
8140 | 8140 | $out .= "\n"; |
8141 | 8141 | |
8142 | 8142 | $nbofextrafieldsshown = 0; |
8143 | - $e = 0; // var to manage the modulo (odd/even) |
|
8143 | + $e = 0; // var to manage the modulo (odd/even) |
|
8144 | 8144 | |
8145 | 8145 | $lastseparatorkeyfound = ''; |
8146 | 8146 | $extrafields_collapse_num = ''; |
@@ -8191,7 +8191,7 @@ discard block |
||
8191 | 8191 | } |
8192 | 8192 | |
8193 | 8193 | $colspan = 0; |
8194 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
8194 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
8195 | 8195 | if (array_key_exists('cols', $params)) { |
8196 | 8196 | $colspan = $params['cols']; |
8197 | 8197 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8278,7 +8278,7 @@ discard block |
||
8278 | 8278 | $domData .= ' data-targetid="'.$this->id.'"'; |
8279 | 8279 | |
8280 | 8280 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
8281 | - if ($display_type=='card') { |
|
8281 | + if ($display_type == 'card') { |
|
8282 | 8282 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
8283 | 8283 | $colspan = 0; |
8284 | 8284 | } |
@@ -8389,12 +8389,12 @@ discard block |
||
8389 | 8389 | break; |
8390 | 8390 | } |
8391 | 8391 | |
8392 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
8392 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
8393 | 8393 | |
8394 | 8394 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
8395 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8395 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8396 | 8396 | } else { |
8397 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8397 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8398 | 8398 | } |
8399 | 8399 | |
8400 | 8400 | $e++; |
@@ -9180,7 +9180,7 @@ discard block |
||
9180 | 9180 | if (!empty($alias)) { |
9181 | 9181 | $keys_with_alias = array(); |
9182 | 9182 | foreach ($keys as $fieldname) { |
9183 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
9183 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
9184 | 9184 | } |
9185 | 9185 | return implode(',', $keys_with_alias); |
9186 | 9186 | } else { |
@@ -9296,7 +9296,7 @@ discard block |
||
9296 | 9296 | if (!$error) { |
9297 | 9297 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
9298 | 9298 | $sql .= " (".implode(", ", $keys).')'; |
9299 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9299 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9300 | 9300 | |
9301 | 9301 | $res = $this->db->query($sql); |
9302 | 9302 | if (!$res) { |
@@ -10078,7 +10078,7 @@ discard block |
||
10078 | 10078 | // Process |
10079 | 10079 | foreach ($to_del as $del) { |
10080 | 10080 | if ($c->fetch($del) > 0) { |
10081 | - $result=$c->del_type($this, $type_categ); |
|
10081 | + $result = $c->del_type($this, $type_categ); |
|
10082 | 10082 | if ($result < 0) { |
10083 | 10083 | $error++; |
10084 | 10084 | $this->error = $c->error; |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | $search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int'); |
139 | 139 | $search_date_start_startyear = GETPOST('search_date_start_startyear', 'int'); |
140 | 140 | $search_date_start_startday = GETPOST('search_date_start_startday', 'int'); |
141 | -$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver |
|
141 | +$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver |
|
142 | 142 | $search_date_start_endmonth = GETPOST('search_date_start_endmonth', 'int'); |
143 | 143 | $search_date_start_endyear = GETPOST('search_date_start_endyear', 'int'); |
144 | 144 | $search_date_start_endday = GETPOST('search_date_start_endday', 'int'); |
145 | -$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver |
|
145 | +$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver |
|
146 | 146 | |
147 | 147 | $search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int'); |
148 | 148 | $search_date_end_startyear = GETPOST('search_date_end_startyear', 'int'); |
149 | 149 | $search_date_end_startday = GETPOST('search_date_end_startday', 'int'); |
150 | -$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver |
|
150 | +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver |
|
151 | 151 | $search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); |
152 | 152 | $search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); |
153 | 153 | $search_date_end_endday = GETPOST('search_date_end_endday', 'int'); |
154 | -$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver |
|
154 | +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver |
|
155 | 155 | if (isModEnabled('categorie')) { |
156 | 156 | $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); |
157 | 157 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); |
438 | 438 | $sql = preg_replace('/,\s*$/', '', $sql); |
439 | 439 | $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as p"; |
440 | -if (!empty($extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
|
440 | +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
|
441 | 441 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; |
442 | 442 | } |
443 | 443 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | if ($searchCategoryProjectOperator == 0) { |
598 | 598 | $searchCategoryProjectSqlList[] = " EXISTS (SELECT ck.fk_project FROM ".MAIN_DB_PREFIX."categorie_project as ck WHERE p.rowid = ck.fk_project AND ck.fk_categorie = ".((int) $searchCategoryProject).")"; |
599 | 599 | } else { |
600 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject); |
|
600 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProject); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | } |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); |
785 | 785 | } |
786 | 786 | if ($search_date_end_end) { |
787 | - $param .= '&search_date_end_end=' . urlencode($search_date_end_end); |
|
787 | + $param .= '&search_date_end_end='.urlencode($search_date_end_end); |
|
788 | 788 | } |
789 | 789 | if ($socid) { |
790 | 790 | $param .= '&socid='.urlencode($socid); |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | $categoriesArr[-2] = '- '.$langs->trans('NotCategorized').' -'; |
977 | 977 | $moreforfilter .= Form::multiselectarray('search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0, 'minwidth300', 0, 0, '', 'category', $tmptitle); |
978 | 978 | $moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ? ' checked="checked"' : '').'/>'; |
979 | - $moreforfilter .= $form->textwithpicto('', $langs->trans('UseOrOperatorForCategories') . ' : ' . $tmptitle, 1, 'help', '', 0, 2, 'tooltip_cat_cus'); // Tooltip on click |
|
979 | + $moreforfilter .= $form->textwithpicto('', $langs->trans('UseOrOperatorForCategories').' : '.$tmptitle, 1, 'help', '', 0, 2, 'tooltip_cat_cus'); // Tooltip on click |
|
980 | 980 | $moreforfilter .= '</div>'; |
981 | 981 | } |
982 | 982 | |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | // Project url |
1382 | 1382 | if (!empty($arrayfields['p.ref']['checked'])) { |
1383 | 1383 | print '<td class="nowraponall">'; |
1384 | - print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':'')); |
|
1384 | + print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int')) ? 'eventorganization' : '')); |
|
1385 | 1385 | if ($object->hasDelay()) { |
1386 | 1386 | print img_warning($langs->trans('Late')); |
1387 | 1387 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | /** |
100 | 100 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
101 | 101 | */ |
102 | - public $fields=array( |
|
102 | + public $fields = array( |
|
103 | 103 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
104 | 104 | 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", "csslist"=>"nowraponall", "showoncombobox"=>1), |
105 | 105 | 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | $datas['label'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
737 | 737 | $datas['question'] = '<br><b>'.$langs->trans('Question').':</b> '.$this->question; |
738 | 738 | $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); |
739 | - $datas['lang'] = '<br><b>'.$langs->trans('Language').':</b> ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; |
|
739 | + $datas['lang'] = '<br><b>'.$langs->trans('Language').':</b> '.picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"').$labellang; |
|
740 | 740 | // show categories for this record only in ajax to not overload lists |
741 | 741 | if (isModEnabled('categorie') && !$nofetch) { |
742 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
742 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
743 | 743 | $form = new Form($this->db); |
744 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); |
|
744 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | return $datas; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | */ |
1125 | 1125 | public function getKanbanView($option = '', $arraydata = null) |
1126 | 1126 | { |
1127 | - global $langs, $selected,$arrayofselected; |
|
1127 | + global $langs, $selected, $arrayofselected; |
|
1128 | 1128 | $return = '<div class="box-flex-item box-flex-grow-zero">'; |
1129 | 1129 | $return .= '<div class="info-box info-box-sm">'; |
1130 | 1130 | $return .= '<span class="info-box-icon bg-infobox-action">'; |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | } |
1142 | 1142 | if (property_exists($this, 'lang') && !empty($this->lang)) { |
1143 | 1143 | $return .= '<br><span class="opacitymedium">'.$langs->trans("Language").'</span> : <span class="info-box-label" title="'.$langs->trans("Language_".$this->lang).'">'.$langs->trans("Language_".$this->lang, '', '', '', '', 12).'</span>'; |
1144 | - $return .= picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"'); |
|
1144 | + $return .= picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"'); |
|
1145 | 1145 | } |
1146 | 1146 | if (method_exists($this, 'getLibStatut')) { |
1147 | 1147 | $return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>'; |