@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public $price; |
| 140 | 140 | |
| 141 | - public $price_formated; // used by takepos/ajax/ajax.php |
|
| 141 | + public $price_formated; // used by takepos/ajax/ajax.php |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * Selling price with tax |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public $price_ttc; |
| 149 | 149 | |
| 150 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
| 150 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * Minimum price net |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | public $packaging; |
| 227 | 227 | |
| 228 | 228 | |
| 229 | - public $lifetime; // In seconds |
|
| 229 | + public $lifetime; // In seconds |
|
| 230 | 230 | |
| 231 | 231 | public $qc_frequency; |
| 232 | 232 | |
@@ -358,20 +358,20 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | //! Metric of products |
| 360 | 360 | public $weight; |
| 361 | - public $weight_units; // scale -3, 0, 3, 6 |
|
| 361 | + public $weight_units; // scale -3, 0, 3, 6 |
|
| 362 | 362 | public $length; |
| 363 | - public $length_units; // scale -3, 0, 3, 6 |
|
| 363 | + public $length_units; // scale -3, 0, 3, 6 |
|
| 364 | 364 | public $width; |
| 365 | - public $width_units; // scale -3, 0, 3, 6 |
|
| 365 | + public $width_units; // scale -3, 0, 3, 6 |
|
| 366 | 366 | public $height; |
| 367 | - public $height_units; // scale -3, 0, 3, 6 |
|
| 367 | + public $height_units; // scale -3, 0, 3, 6 |
|
| 368 | 368 | public $surface; |
| 369 | - public $surface_units; // scale -3, 0, 3, 6 |
|
| 369 | + public $surface_units; // scale -3, 0, 3, 6 |
|
| 370 | 370 | public $volume; |
| 371 | - public $volume_units; // scale -3, 0, 3, 6 |
|
| 371 | + public $volume_units; // scale -3, 0, 3, 6 |
|
| 372 | 372 | |
| 373 | 373 | public $net_measure; |
| 374 | - public $net_measure_units; // scale -3, 0, 3, 6 |
|
| 374 | + public $net_measure_units; // scale -3, 0, 3, 6 |
|
| 375 | 375 | |
| 376 | 376 | public $accountancy_code_sell; |
| 377 | 377 | public $accountancy_code_sell_intra; |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), |
| 559 | 559 | //'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')), |
| 560 | 560 | //'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')), |
| 561 | - 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
| 561 | + 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatory_period', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
| 562 | 562 | ); |
| 563 | 563 | |
| 564 | 564 | /** |
@@ -856,9 +856,9 @@ discard block |
||
| 856 | 856 | |
| 857 | 857 | // update accountancy for this entity |
| 858 | 858 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 859 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
| 859 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
| 860 | 860 | |
| 861 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
| 861 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
| 862 | 862 | $sql .= " fk_product"; |
| 863 | 863 | $sql .= ", entity"; |
| 864 | 864 | $sql .= ", accountancy_code_buy"; |
@@ -869,13 +869,13 @@ discard block |
||
| 869 | 869 | $sql .= ", accountancy_code_sell_export"; |
| 870 | 870 | $sql .= ") VALUES ("; |
| 871 | 871 | $sql .= $this->id; |
| 872 | - $sql .= ", " . $conf->entity; |
|
| 873 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 874 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 875 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 876 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 877 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 878 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 872 | + $sql .= ", ".$conf->entity; |
|
| 873 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 874 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 875 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 876 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 877 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 878 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 879 | 879 | $sql .= ")"; |
| 880 | 880 | $result = $this->db->query($sql); |
| 881 | 881 | if (!$result) { |
@@ -1240,12 +1240,12 @@ discard block |
||
| 1240 | 1240 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); |
| 1241 | 1241 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; |
| 1242 | 1242 | if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 1243 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1244 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 1245 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 1246 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1247 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 1248 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 1243 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1244 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 1245 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 1246 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1247 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 1248 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 1249 | 1249 | } |
| 1250 | 1250 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); |
| 1251 | 1251 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); |
| 1254 | 1254 | $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); |
| 1255 | 1255 | $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); |
| 1256 | - $sql .= ", mandatory_period = ".($this->mandatory_period ); |
|
| 1256 | + $sql .= ", mandatory_period = ".($this->mandatory_period); |
|
| 1257 | 1257 | // stock field is not here because it is a denormalized value from product_stock. |
| 1258 | 1258 | $sql .= " WHERE rowid = ".((int) $id); |
| 1259 | 1259 | |
@@ -1275,9 +1275,9 @@ discard block |
||
| 1275 | 1275 | |
| 1276 | 1276 | // update accountancy for this entity |
| 1277 | 1277 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 1278 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
| 1278 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
| 1279 | 1279 | |
| 1280 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
| 1280 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
| 1281 | 1281 | $sql .= " fk_product"; |
| 1282 | 1282 | $sql .= ", entity"; |
| 1283 | 1283 | $sql .= ", accountancy_code_buy"; |
@@ -1288,13 +1288,13 @@ discard block |
||
| 1288 | 1288 | $sql .= ", accountancy_code_sell_export"; |
| 1289 | 1289 | $sql .= ") VALUES ("; |
| 1290 | 1290 | $sql .= $this->id; |
| 1291 | - $sql .= ", " . $conf->entity; |
|
| 1292 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1293 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 1294 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 1295 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1296 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 1297 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 1291 | + $sql .= ", ".$conf->entity; |
|
| 1292 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1293 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 1294 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 1295 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1296 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 1297 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 1298 | 1298 | $sql .= ")"; |
| 1299 | 1299 | $result = $this->db->query($sql); |
| 1300 | 1300 | if (!$result) { |
@@ -1592,7 +1592,7 @@ discard block |
||
| 1592 | 1592 | } |
| 1593 | 1593 | } elseif (isset($this->multilangs[$key])) { |
| 1594 | 1594 | if (empty($this->multilangs["$key"]["label"])) { |
| 1595 | - $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
| 1595 | + $this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
| 1596 | 1596 | return -1; |
| 1597 | 1597 | } |
| 1598 | 1598 | |
@@ -1788,7 +1788,7 @@ discard block |
||
| 1788 | 1788 | private function getArrayForPriceCompare($level = 0) |
| 1789 | 1789 | { |
| 1790 | 1790 | |
| 1791 | - $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); |
|
| 1791 | + $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); |
|
| 1792 | 1792 | |
| 1793 | 1793 | foreach ($testExit as $field) { |
| 1794 | 1794 | if (!isset($this->$field)) { |
@@ -2411,20 +2411,20 @@ discard block |
||
| 2411 | 2411 | |
| 2412 | 2412 | //For MultiCompany |
| 2413 | 2413 | //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity |
| 2414 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
| 2415 | - $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. |
|
| 2414 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
| 2415 | + $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. |
|
| 2416 | 2416 | $visibleWarehousesEntities = $conf->entity; |
| 2417 | 2417 | if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { |
| 2418 | 2418 | if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { |
| 2419 | - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
| 2420 | - if ($this->db->num_rows($checkPMPPerEntity)>0) { |
|
| 2419 | + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
| 2420 | + if ($this->db->num_rows($checkPMPPerEntity) > 0) { |
|
| 2421 | 2421 | $separatedEntityPMP = true; |
| 2422 | 2422 | } |
| 2423 | 2423 | } |
| 2424 | 2424 | global $mc; |
| 2425 | 2425 | $separatedStock = true; |
| 2426 | 2426 | if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { |
| 2427 | - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); |
|
| 2427 | + $visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); |
|
| 2428 | 2428 | } |
| 2429 | 2429 | } |
| 2430 | 2430 | if ($separatedEntityPMP) { |
@@ -2441,10 +2441,10 @@ discard block |
||
| 2441 | 2441 | } |
| 2442 | 2442 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
| 2443 | 2443 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { |
| 2444 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 2444 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 2445 | 2445 | } |
| 2446 | 2446 | if ($separatedStock) { |
| 2447 | - $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)."))"; |
|
| 2447 | + $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)."))"; |
|
| 2448 | 2448 | } |
| 2449 | 2449 | |
| 2450 | 2450 | if ($id) { |
@@ -2598,15 +2598,15 @@ discard block |
||
| 2598 | 2598 | $sql .= " WHERE entity IN (".getEntity('productprice').")"; |
| 2599 | 2599 | $sql .= " AND price_level=".((int) $i); |
| 2600 | 2600 | $sql .= " AND fk_product = ".((int) $this->id); |
| 2601 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
| 2602 | - $sql .= " LIMIT 1"; // Only the first one |
|
| 2601 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
| 2602 | + $sql .= " LIMIT 1"; // Only the first one |
|
| 2603 | 2603 | $resql = $this->db->query($sql); |
| 2604 | 2604 | if ($resql) { |
| 2605 | 2605 | $result = $this->db->fetch_array($resql); |
| 2606 | 2606 | |
| 2607 | 2607 | $this->multiprices[$i] = $result ? $result["price"] : null; |
| 2608 | 2608 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; |
| 2609 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
| 2609 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
| 2610 | 2610 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; |
| 2611 | 2611 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; |
| 2612 | 2612 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on |
@@ -2826,7 +2826,7 @@ discard block |
||
| 2826 | 2826 | $obj = $this->db->fetch_object($result); |
| 2827 | 2827 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
| 2828 | 2828 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
| 2829 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
| 2829 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
| 2830 | 2830 | } else { |
| 2831 | 2831 | $this->error = $this->db->error(); |
| 2832 | 2832 | $error++; |
@@ -4300,7 +4300,7 @@ discard block |
||
| 4300 | 4300 | //Addition of a product with the highest rank +1 |
| 4301 | 4301 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; |
| 4302 | 4302 | $sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".price2num($incdec, 'MS').", ".((int) $rank).")"; |
| 4303 | - if (! $this->db->query($sql)) { |
|
| 4303 | + if (!$this->db->query($sql)) { |
|
| 4304 | 4304 | dol_print_error($this->db); |
| 4305 | 4305 | return -1; |
| 4306 | 4306 | } else { |
@@ -4383,17 +4383,17 @@ discard block |
||
| 4383 | 4383 | |
| 4384 | 4384 | // Updated ranks so that none are missing |
| 4385 | 4385 | $sqlrank = "SELECT rowid, rang FROM ".$this->db->prefix()."product_association"; |
| 4386 | - $sqlrank.= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
| 4387 | - $sqlrank.= " ORDER BY rang"; |
|
| 4386 | + $sqlrank .= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
| 4387 | + $sqlrank .= " ORDER BY rang"; |
|
| 4388 | 4388 | $resqlrank = $this->db->query($sqlrank); |
| 4389 | 4389 | if ($resqlrank) { |
| 4390 | 4390 | $cpt = 0; |
| 4391 | 4391 | while ($objrank = $this->db->fetch_object($resqlrank)) { |
| 4392 | 4392 | $cpt++; |
| 4393 | 4393 | $sql = "UPDATE ".$this->db->prefix()."product_association"; |
| 4394 | - $sql.= " SET rang = ".((int) $cpt); |
|
| 4395 | - $sql.= " WHERE rowid = ".((int) $objrank->rowid); |
|
| 4396 | - if (! $this->db->query($sql)) { |
|
| 4394 | + $sql .= " SET rang = ".((int) $cpt); |
|
| 4395 | + $sql .= " WHERE rowid = ".((int) $objrank->rowid); |
|
| 4396 | + if (!$this->db->query($sql)) { |
|
| 4397 | 4397 | dol_print_error($this->db); |
| 4398 | 4398 | return -1; |
| 4399 | 4399 | } |
@@ -4814,7 +4814,7 @@ discard block |
||
| 4814 | 4814 | if (isset($this->sousprods) && is_array($this->sousprods)) { |
| 4815 | 4815 | foreach ($this->sousprods as $prod_name => $desc_product) { |
| 4816 | 4816 | if (is_array($desc_product)) { |
| 4817 | - $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
| 4817 | + $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
| 4818 | 4818 | } |
| 4819 | 4819 | } |
| 4820 | 4820 | } |
@@ -4969,9 +4969,9 @@ discard block |
||
| 4969 | 4969 | $sql .= " WHERE p.rowid = pa.fk_product_fils"; |
| 4970 | 4970 | $sql .= " AND pa.fk_product_pere = ".((int) $id); |
| 4971 | 4971 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens |
| 4972 | - $sql.= " ORDER BY pa.rang"; |
|
| 4972 | + $sql .= " ORDER BY pa.rang"; |
|
| 4973 | 4973 | |
| 4974 | - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); |
|
| 4974 | + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ?implode(',', $parents) : $parents), LOG_DEBUG); |
|
| 4975 | 4975 | |
| 4976 | 4976 | if ($level == 1) { |
| 4977 | 4977 | $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 |
@@ -5061,38 +5061,38 @@ discard block |
||
| 5061 | 5061 | if (!empty($this->entity)) { |
| 5062 | 5062 | $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1); |
| 5063 | 5063 | if ($this->nbphoto > 0) { |
| 5064 | - $datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>'; |
|
| 5064 | + $datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>'; |
|
| 5065 | 5065 | } |
| 5066 | 5066 | } |
| 5067 | 5067 | |
| 5068 | 5068 | if ($this->type == Product::TYPE_PRODUCT) { |
| 5069 | 5069 | $datas['picto'] = img_picto('', 'product').' <u class="paddingrightonly">'.$langs->trans("Product").'</u>'; |
| 5070 | 5070 | } elseif ($this->type == Product::TYPE_SERVICE) { |
| 5071 | - $datas['picto']= img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
| 5071 | + $datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
| 5072 | 5072 | } |
| 5073 | 5073 | if (isset($this->status) && isset($this->status_buy)) { |
| 5074 | - $datas['status']= ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); |
|
| 5074 | + $datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1); |
|
| 5075 | 5075 | } |
| 5076 | 5076 | |
| 5077 | 5077 | if (!empty($this->ref)) { |
| 5078 | - $datas['ref']= '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
| 5078 | + $datas['ref'] = '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
| 5079 | 5079 | } |
| 5080 | 5080 | if (!empty($this->label)) { |
| 5081 | - $datas['label']= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
| 5081 | + $datas['label'] = '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
| 5082 | 5082 | } |
| 5083 | 5083 | if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
| 5084 | 5084 | if (isModEnabled('productbatch')) { |
| 5085 | 5085 | $langs->load("productbatch"); |
| 5086 | - $datas['batchstatus']= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
| 5086 | + $datas['batchstatus'] = "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
| 5087 | 5087 | } |
| 5088 | 5088 | } |
| 5089 | 5089 | if (isModEnabled('barcode')) { |
| 5090 | - $datas['barcode']= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
| 5090 | + $datas['barcode'] = '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
| 5091 | 5091 | } |
| 5092 | 5092 | |
| 5093 | 5093 | if ($this->type == Product::TYPE_PRODUCT) { |
| 5094 | 5094 | if ($this->weight) { |
| 5095 | - $datas['weight']= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
| 5095 | + $datas['weight'] = "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
| 5096 | 5096 | } |
| 5097 | 5097 | $labelsize = ""; |
| 5098 | 5098 | if ($this->length) { |
@@ -5105,7 +5105,7 @@ discard block |
||
| 5105 | 5105 | $labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); |
| 5106 | 5106 | } |
| 5107 | 5107 | if ($labelsize) { |
| 5108 | - $datas['size']= "<br>".$labelsize; |
|
| 5108 | + $datas['size'] = "<br>".$labelsize; |
|
| 5109 | 5109 | } |
| 5110 | 5110 | |
| 5111 | 5111 | $labelsurfacevolume = ""; |
@@ -5116,7 +5116,7 @@ discard block |
||
| 5116 | 5116 | $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); |
| 5117 | 5117 | } |
| 5118 | 5118 | if ($labelsurfacevolume) { |
| 5119 | - $datas['surface']= "<br>" . $labelsurfacevolume; |
|
| 5119 | + $datas['surface'] = "<br>".$labelsurfacevolume; |
|
| 5120 | 5120 | } |
| 5121 | 5121 | } |
| 5122 | 5122 | if (!empty($this->pmp) && $this->pmp) { |
@@ -5146,9 +5146,9 @@ discard block |
||
| 5146 | 5146 | } |
| 5147 | 5147 | // show categories for this record only in ajax to not overload lists |
| 5148 | 5148 | if (isModEnabled('categorie') && !$nofetch) { |
| 5149 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 5149 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 5150 | 5150 | $form = new Form($this->db); |
| 5151 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
| 5151 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
| 5152 | 5152 | } |
| 5153 | 5153 | |
| 5154 | 5154 | return $datas; |
@@ -5200,7 +5200,7 @@ discard block |
||
| 5200 | 5200 | $label = $langs->trans("ShowProduct"); |
| 5201 | 5201 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; |
| 5202 | 5202 | } |
| 5203 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"'); |
|
| 5203 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"'); |
|
| 5204 | 5204 | $linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; |
| 5205 | 5205 | } else { |
| 5206 | 5206 | $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; |
@@ -5377,7 +5377,7 @@ discard block |
||
| 5377 | 5377 | $labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial')); |
| 5378 | 5378 | $labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort')); |
| 5379 | 5379 | } |
| 5380 | - } elseif ( $type == 2 && $status == 2 ) { |
|
| 5380 | + } elseif ($type == 2 && $status == 2) { |
|
| 5381 | 5381 | $labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial'); |
| 5382 | 5382 | $labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'); |
| 5383 | 5383 | } |
@@ -5587,7 +5587,7 @@ discard block |
||
| 5587 | 5587 | $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; |
| 5588 | 5588 | } |
| 5589 | 5589 | |
| 5590 | - $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; |
|
| 5590 | + $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; |
|
| 5591 | 5591 | |
| 5592 | 5592 | dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); |
| 5593 | 5593 | $result = $this->db->query($sql); |
@@ -5668,7 +5668,7 @@ discard block |
||
| 5668 | 5668 | if (isModEnabled("supplier_order")) { |
| 5669 | 5669 | $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; |
| 5670 | 5670 | if (isset($includedraftpoforvirtual)) { |
| 5671 | - $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 |
|
| 5671 | + $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 |
|
| 5672 | 5672 | } |
| 5673 | 5673 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); |
| 5674 | 5674 | if ($result < 0) { |
@@ -6369,7 +6369,7 @@ discard block |
||
| 6369 | 6369 | global $langs; |
| 6370 | 6370 | |
| 6371 | 6371 | if (empty($this->duration_value)) { |
| 6372 | - $this->errors[]='ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
| 6372 | + $this->errors[] = 'ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
| 6373 | 6373 | return -1; |
| 6374 | 6374 | } |
| 6375 | 6375 | |
@@ -6406,7 +6406,7 @@ discard block |
||
| 6406 | 6406 | */ |
| 6407 | 6407 | public function getKanbanView($option = '', $arraydata = null) |
| 6408 | 6408 | { |
| 6409 | - global $langs,$conf; |
|
| 6409 | + global $langs, $conf; |
|
| 6410 | 6410 | |
| 6411 | 6411 | $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); |
| 6412 | 6412 | |
@@ -6445,7 +6445,7 @@ discard block |
||
| 6445 | 6445 | $return .= '<br><span class="info-box-status opacitymedium">'.$langs->trans('PhysicalStock').' : <span class="bold">'.$this->stock_reel.'</span></span>'; |
| 6446 | 6446 | } |
| 6447 | 6447 | if (method_exists($this, 'getLibStatut')) { |
| 6448 | - $return .='<br><span class="info-box-status margintoponly">'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).'</span>'; |
|
| 6448 | + $return .= '<br><span class="info-box-status margintoponly">'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).'</span>'; |
|
| 6449 | 6449 | } |
| 6450 | 6450 | $return .= '</div>'; |
| 6451 | 6451 | $return .= '</div>'; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $maxfilesizearray = getMaxFileSizeArray(); |
| 199 | 199 | $maxmin = $maxfilesizearray['maxmin']; |
| 200 | 200 | if ($maxmin > 0) { |
| 201 | - $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 201 | + $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 202 | 202 | } |
| 203 | 203 | $texte .= ' <input type="file" name="uploadfile">'; |
| 204 | 204 | $texte .= '<input type="hidden" value="USERGROUP_ADDON_PDF_ODT_PATH" name="keyforuploaddir">'; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); |
| 288 | 288 | $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); |
| 289 | 289 | |
| 290 | - $newfiletmp = $objectref . '_' . $newfiletmp; |
|
| 290 | + $newfiletmp = $objectref.'_'.$newfiletmp; |
|
| 291 | 291 | |
| 292 | 292 | // Get extension (ods or odt) |
| 293 | 293 | $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | if ($format == '1') { |
| 297 | 297 | $format = '%Y%m%d%H%M%S'; |
| 298 | 298 | } |
| 299 | - $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat; |
|
| 299 | + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; |
|
| 300 | 300 | } else { |
| 301 | - $filename = $newfiletmp . '.' . $newfileformat; |
|
| 301 | + $filename = $newfiletmp.'.'.$newfileformat; |
|
| 302 | 302 | } |
| 303 | - $file = $dir . '/' . $filename; |
|
| 303 | + $file = $dir.'/'.$filename; |
|
| 304 | 304 | //print "newdir=".$dir; |
| 305 | 305 | //print "newfile=".$newfile; |
| 306 | 306 | //print "file=".$file; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | dol_mkdir($conf->user->dir_temp); |
| 310 | 310 | if (!is_writable($conf->user->dir_temp)) { |
| 311 | 311 | $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->user->dir_temp); |
| 312 | - dol_syslog('Error in write_file: ' . $this->error, LOG_ERR); |
|
| 312 | + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); |
|
| 313 | 313 | return -1; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | if (($id > 0 || (!empty($ref) && !in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0)) { |
| 32 | 32 | if (($id > 0 && is_numeric($id)) || !empty($ref)) { // To discard case when id is list of ids like '1,2,3...' |
| 33 | 33 | if ($object->element == 'usergroup') { |
| 34 | - $ret = $object->fetch($id, (empty($ref)? '' : $ref), true); // to load $object->members |
|
| 34 | + $ret = $object->fetch($id, (empty($ref) ? '' : $ref), true); // to load $object->members |
|
| 35 | 35 | } else { |
| 36 | - $ret = $object->fetch($id, (empty($ref)? '' : $ref)); |
|
| 36 | + $ret = $object->fetch($id, (empty($ref) ? '' : $ref)); |
|
| 37 | 37 | } |
| 38 | 38 | if ($ret > 0) { |
| 39 | 39 | $object->fetch_thirdparty(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * Only common components are here. |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | $effs = array(); |
| 57 | 57 | |
| 58 | 58 | $sql = "SELECT id, code, libelle as label"; |
| 59 | - $sql .= " FROM " . $this->db->prefix() . "c_typent"; |
|
| 60 | - $sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . (empty($mysoc->country_id) ? '0' : $mysoc->country_id) . ")"; |
|
| 59 | + $sql .= " FROM ".$this->db->prefix()."c_typent"; |
|
| 60 | + $sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")"; |
|
| 61 | 61 | if ($filter) { |
| 62 | - $sql .= " " . $filter; |
|
| 62 | + $sql .= " ".$filter; |
|
| 63 | 63 | } |
| 64 | 64 | $sql .= " ORDER by position, id"; |
| 65 | - dol_syslog(get_class($this) . '::typent_array', LOG_DEBUG); |
|
| 65 | + dol_syslog(get_class($this).'::typent_array', LOG_DEBUG); |
|
| 66 | 66 | $resql = $this->db->query($sql); |
| 67 | 67 | if ($resql) { |
| 68 | 68 | $num = $this->db->num_rows($resql); |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | $effs = array(); |
| 106 | 106 | |
| 107 | 107 | $sql = "SELECT id, code, libelle as label"; |
| 108 | - $sql .= " FROM " . $this->db->prefix() . "c_effectif"; |
|
| 108 | + $sql .= " FROM ".$this->db->prefix()."c_effectif"; |
|
| 109 | 109 | $sql .= " WHERE active = 1"; |
| 110 | 110 | if ($filter) { |
| 111 | - $sql .= " " . $filter; |
|
| 111 | + $sql .= " ".$filter; |
|
| 112 | 112 | } |
| 113 | 113 | $sql .= " ORDER BY id ASC"; |
| 114 | - dol_syslog(get_class($this) . '::effectif_array', LOG_DEBUG); |
|
| 114 | + dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG); |
|
| 115 | 115 | $resql = $this->db->query($sql); |
| 116 | 116 | if ($resql) { |
| 117 | 117 | $num = $this->db->num_rows($resql); |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | // phpcs:enable |
| 150 | 150 | global $user, $langs; |
| 151 | 151 | |
| 152 | - print '<form method="post" action="' . $page . '">'; |
|
| 152 | + print '<form method="post" action="'.$page.'">'; |
|
| 153 | 153 | print '<input type="hidden" name="action" value="setprospectlevel">'; |
| 154 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 154 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 155 | 155 | |
| 156 | - dol_syslog(get_class($this) . '::form_prospect_level', LOG_DEBUG); |
|
| 156 | + dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG); |
|
| 157 | 157 | $sql = "SELECT code, label"; |
| 158 | - $sql .= " FROM " . $this->db->prefix() . "c_prospectlevel"; |
|
| 158 | + $sql .= " FROM ".$this->db->prefix()."c_prospectlevel"; |
|
| 159 | 159 | $sql .= " WHERE active > 0"; |
| 160 | 160 | $sql .= " ORDER BY sortorder"; |
| 161 | 161 | $resql = $this->db->query($sql); |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | dol_print_error($this->db); |
| 182 | 182 | } |
| 183 | 183 | if (!empty($htmlname) && $user->admin) { |
| 184 | - print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 184 | + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 185 | 185 | } |
| 186 | - print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">'; |
|
| 186 | + print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">'; |
|
| 187 | 187 | print '</form>'; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | global $user, $langs; |
| 202 | 202 | |
| 203 | - print '<form method="post" action="' . $page . '">'; |
|
| 203 | + print '<form method="post" action="'.$page.'">'; |
|
| 204 | 204 | print '<input type="hidden" name="action" value="setprospectcontactlevel">'; |
| 205 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 205 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 206 | 206 | |
| 207 | 207 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 208 | 208 | $sql = "SELECT code, label"; |
| 209 | - $sql .= " FROM " . $this->db->prefix() . "c_prospectcontactlevel"; |
|
| 209 | + $sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel"; |
|
| 210 | 210 | $sql .= " WHERE active > 0"; |
| 211 | 211 | $sql .= " ORDER BY sortorder"; |
| 212 | 212 | $resql = $this->db->query($sql); |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | dol_print_error($this->db); |
| 233 | 233 | } |
| 234 | 234 | if (!empty($htmlname) && $user->admin) { |
| 235 | - print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 235 | + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 236 | 236 | } |
| 237 | - print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">'; |
|
| 237 | + print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">'; |
|
| 238 | 238 | print '</form>'; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // phpcs:enable |
| 276 | 276 | global $conf, $langs, $user; |
| 277 | 277 | |
| 278 | - dol_syslog(get_class($this) . "::select_departement selected=" . $selected . ", country_codeid=" . $country_codeid, LOG_DEBUG); |
|
| 278 | + dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG); |
|
| 279 | 279 | |
| 280 | 280 | $langs->load("dict"); |
| 281 | 281 | |
@@ -283,28 +283,28 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // Serch departements/cantons/province active d'une region et pays actif |
| 285 | 285 | $sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM"; |
| 286 | - $sql .= " " . $this->db->prefix() . "c_departements as d, " . $this->db->prefix() . "c_regions as r," . $this->db->prefix() . "c_country as c"; |
|
| 286 | + $sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c"; |
|
| 287 | 287 | $sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid"; |
| 288 | 288 | $sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1"; |
| 289 | 289 | if ($country_codeid && is_numeric($country_codeid)) { |
| 290 | - $sql .= " AND c.rowid = '" . $this->db->escape($country_codeid) . "'"; |
|
| 290 | + $sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'"; |
|
| 291 | 291 | } |
| 292 | 292 | if ($country_codeid && !is_numeric($country_codeid)) { |
| 293 | - $sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'"; |
|
| 293 | + $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'"; |
|
| 294 | 294 | } |
| 295 | 295 | $sql .= " ORDER BY c.code, d.code_departement"; |
| 296 | 296 | |
| 297 | 297 | $result = $this->db->query($sql); |
| 298 | 298 | if ($result) { |
| 299 | 299 | if (!empty($htmlname)) { |
| 300 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
| 300 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
| 301 | 301 | } |
| 302 | 302 | if ($country_codeid) { |
| 303 | 303 | $out .= '<option value="0"> </option>'; |
| 304 | 304 | } |
| 305 | 305 | $num = $this->db->num_rows($result); |
| 306 | 306 | $i = 0; |
| 307 | - dol_syslog(get_class($this) . "::select_departement num=" . $num, LOG_DEBUG); |
|
| 307 | + dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG); |
|
| 308 | 308 | if ($num) { |
| 309 | 309 | $country = ''; |
| 310 | 310 | while ($i < $num) { |
@@ -315,15 +315,15 @@ discard block |
||
| 315 | 315 | if (!$country || $country != $obj->country) { |
| 316 | 316 | // Show break if we are in list with multiple countries |
| 317 | 317 | if (!$country_codeid && $obj->country_code) { |
| 318 | - $out .= '<option value="-1" disabled data-html="----- ' . $obj->country . ' -----">----- ' . $obj->country . " -----</option>\n"; |
|
| 318 | + $out .= '<option value="-1" disabled data-html="----- '.$obj->country.' -----">----- '.$obj->country." -----</option>\n"; |
|
| 319 | 319 | $country = $obj->country; |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | if (!empty($selected) && $selected == $obj->rowid) { |
| 324 | - $out .= '<option value="' . $obj->rowid . '" selected>'; |
|
| 324 | + $out .= '<option value="'.$obj->rowid.'" selected>'; |
|
| 325 | 325 | } else { |
| 326 | - $out .= '<option value="' . $obj->rowid . '">'; |
|
| 326 | + $out .= '<option value="'.$obj->rowid.'">'; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
@@ -332,13 +332,13 @@ discard block |
||
| 332 | 332 | ($conf->global->MAIN_SHOW_STATE_CODE == 1 || $conf->global->MAIN_SHOW_STATE_CODE == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all') |
| 333 | 333 | ) { |
| 334 | 334 | if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) { |
| 335 | - $out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 335 | + $out .= $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 336 | 336 | } else { |
| 337 | - $out .= $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 337 | + $out .= $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 338 | 338 | } |
| 339 | 339 | } else { |
| 340 | 340 | if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) { |
| 341 | - $out .= $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 341 | + $out .= $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
| 342 | 342 | } else { |
| 343 | 343 | $out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
| 344 | 344 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $out .= '</select>'; |
| 354 | 354 | } |
| 355 | 355 | if (!empty($htmlname) && $user->admin) { |
| 356 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 356 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 357 | 357 | } |
| 358 | 358 | } else { |
| 359 | 359 | dol_print_error($this->db); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | // Make select dynamic |
| 363 | 363 | if (!empty($htmlname)) { |
| 364 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 364 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 365 | 365 | $out .= ajax_combobox($htmlname); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300') |
| 387 | 387 | { |
| 388 | 388 | $html = '<script>'; |
| 389 | - $html.='$("select[name=\"'.$parent_field_id.'\"]").change(function(){ |
|
| 389 | + $html .= '$("select[name=\"'.$parent_field_id.'\"]").change(function(){ |
|
| 390 | 390 | $.ajax( "'.dol_buildpath('/core/ajax/ziptown.php', 2).'", { data:{ selected: $("select[name=\"'.$htmlname.'\"]").val(), country_codeid: $(this).val(), htmlname:"'.$htmlname.'", morecss:"'.$morecss.'" } } ) |
| 391 | 391 | .done(function(msg) { |
| 392 | 392 | $("span#target_'.$htmlname.'").html(msg); |
@@ -413,14 +413,14 @@ discard block |
||
| 413 | 413 | $langs->load("dict"); |
| 414 | 414 | |
| 415 | 415 | $sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country"; |
| 416 | - $sql .= " FROM " . $this->db->prefix() . "c_regions as r, " . $this->db->prefix() . "c_country as c"; |
|
| 416 | + $sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c"; |
|
| 417 | 417 | $sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1"; |
| 418 | 418 | $sql .= " ORDER BY c.code, c.label ASC"; |
| 419 | 419 | |
| 420 | - dol_syslog(get_class($this) . "::select_region", LOG_DEBUG); |
|
| 420 | + dol_syslog(get_class($this)."::select_region", LOG_DEBUG); |
|
| 421 | 421 | $resql = $this->db->query($sql); |
| 422 | 422 | if ($resql) { |
| 423 | - print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
| 423 | + print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
| 424 | 424 | $num = $this->db->num_rows($resql); |
| 425 | 425 | $i = 0; |
| 426 | 426 | if ($num) { |
@@ -432,16 +432,16 @@ discard block |
||
| 432 | 432 | } else { |
| 433 | 433 | if ($country == '' || $country != $obj->country) { |
| 434 | 434 | // Show break |
| 435 | - $key = $langs->trans("Country" . strtoupper($obj->country_code)); |
|
| 436 | - $valuetoshow = ($key != "Country" . strtoupper($obj->country_code)) ? $obj->country_code . " - " . $key : $obj->country; |
|
| 437 | - print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option>\n"; |
|
| 435 | + $key = $langs->trans("Country".strtoupper($obj->country_code)); |
|
| 436 | + $valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country; |
|
| 437 | + print '<option value="-2" disabled>----- '.$valuetoshow." -----</option>\n"; |
|
| 438 | 438 | $country = $obj->country; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | if ($selected > 0 && $selected == $obj->code) { |
| 442 | - print '<option value="' . $obj->code . '" selected>' . $obj->label . '</option>'; |
|
| 442 | + print '<option value="'.$obj->code.'" selected>'.$obj->label.'</option>'; |
|
| 443 | 443 | } else { |
| 444 | - print '<option value="' . $obj->code . '">' . $obj->label . '</option>'; |
|
| 444 | + print '<option value="'.$obj->code.'">'.$obj->label.'</option>'; |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | $i++; |
@@ -472,13 +472,13 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | $out = ''; |
| 474 | 474 | |
| 475 | - $sql = "SELECT rowid, code, label, active FROM " . $this->db->prefix() . "c_civility"; |
|
| 475 | + $sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility"; |
|
| 476 | 476 | $sql .= " WHERE active = 1"; |
| 477 | 477 | |
| 478 | 478 | dol_syslog("Form::select_civility", LOG_DEBUG); |
| 479 | 479 | $resql = $this->db->query($sql); |
| 480 | 480 | if ($resql) { |
| 481 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 481 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 482 | 482 | $out .= '<option value=""> </option>'; |
| 483 | 483 | $num = $this->db->num_rows($resql); |
| 484 | 484 | $i = 0; |
@@ -486,12 +486,12 @@ discard block |
||
| 486 | 486 | while ($i < $num) { |
| 487 | 487 | $obj = $this->db->fetch_object($resql); |
| 488 | 488 | if ($selected == $obj->code) { |
| 489 | - $out .= '<option value="' . $obj->code . '" selected>'; |
|
| 489 | + $out .= '<option value="'.$obj->code.'" selected>'; |
|
| 490 | 490 | } else { |
| 491 | - $out .= '<option value="' . $obj->code . '">'; |
|
| 491 | + $out .= '<option value="'.$obj->code.'">'; |
|
| 492 | 492 | } |
| 493 | 493 | // If translation exists, we use it, otherwise, we use tha had coded label |
| 494 | - $out .= ($langs->trans("Civility" . $obj->code) != "Civility" . $obj->code ? $langs->trans("Civility" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 494 | + $out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
| 495 | 495 | $out .= '</option>'; |
| 496 | 496 | $i++; |
| 497 | 497 | } |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | if ($addjscombo) { |
| 505 | 505 | // Enhance with select2 |
| 506 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 506 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 507 | 507 | $out .= ajax_combobox($htmlname); |
| 508 | 508 | } |
| 509 | 509 | } else { |
@@ -553,22 +553,22 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | // On recherche les formes juridiques actives des pays actifs |
| 555 | 555 | $sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code"; |
| 556 | - $sql .= " FROM " . $this->db->prefix() . "c_forme_juridique as f, " . $this->db->prefix() . "c_country as c"; |
|
| 556 | + $sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c"; |
|
| 557 | 557 | $sql .= " WHERE f.fk_pays=c.rowid"; |
| 558 | 558 | $sql .= " AND f.active = 1 AND c.active = 1"; |
| 559 | 559 | if ($country_codeid) { |
| 560 | - $sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'"; |
|
| 560 | + $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'"; |
|
| 561 | 561 | } |
| 562 | 562 | if ($filter) { |
| 563 | - $sql .= " " . $filter; |
|
| 563 | + $sql .= " ".$filter; |
|
| 564 | 564 | } |
| 565 | 565 | $sql .= " ORDER BY c.code"; |
| 566 | 566 | |
| 567 | - dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG); |
|
| 567 | + dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG); |
|
| 568 | 568 | $resql = $this->db->query($sql); |
| 569 | 569 | if ($resql) { |
| 570 | 570 | $out .= '<div id="particulier2" class="visible">'; |
| 571 | - $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 571 | + $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 572 | 572 | if ($country_codeid) { |
| 573 | 573 | $out .= '<option value="0"> </option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. |
| 574 | 574 | } |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | $obj = $this->db->fetch_object($resql); |
| 583 | 583 | |
| 584 | 584 | if ($obj->code) { // We exclude empty line, we will add it later |
| 585 | - $labelcountry = (($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) ? $langs->trans("Country" . $obj->country_code) : $obj->country); |
|
| 586 | - $labeljs = (($langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code) ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver) |
|
| 587 | - $arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry); |
|
| 585 | + $labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country); |
|
| 586 | + $labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver) |
|
| 587 | + $arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry.'_'.$labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry); |
|
| 588 | 588 | } |
| 589 | 589 | $i++; |
| 590 | 590 | } |
@@ -598,15 +598,15 @@ discard block |
||
| 598 | 598 | if (!$country || $country != $val['country']) { |
| 599 | 599 | // Show break when we are in multi country mode |
| 600 | 600 | if (empty($country_codeid) && $val['country_code']) { |
| 601 | - $out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n"; |
|
| 601 | + $out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n"; |
|
| 602 | 602 | $country = $val['country']; |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if ($selected > 0 && $selected == $val['code']) { |
| 607 | - $out .= '<option value="' . $val['code'] . '" selected>'; |
|
| 607 | + $out .= '<option value="'.$val['code'].'" selected>'; |
|
| 608 | 608 | } else { |
| 609 | - $out .= '<option value="' . $val['code'] . '">'; |
|
| 609 | + $out .= '<option value="'.$val['code'].'">'; |
|
| 610 | 610 | } |
| 611 | 611 | // If translation exists, we use it, otherwise we use default label in database |
| 612 | 612 | $out .= $val['label']; |
@@ -615,11 +615,11 @@ discard block |
||
| 615 | 615 | } |
| 616 | 616 | $out .= '</select>'; |
| 617 | 617 | if ($user->admin) { |
| 618 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 618 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | // Make select dynamic |
| 622 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
| 622 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
| 623 | 623 | $out .= ajax_combobox($htmlname); |
| 624 | 624 | |
| 625 | 625 | $out .= '</div>'; |
@@ -673,13 +673,13 @@ discard block |
||
| 673 | 673 | $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); |
| 674 | 674 | |
| 675 | 675 | if (count($events)) { // If there is some ajax events to run once selection is done, we add code here to run events |
| 676 | - print '<script nonce="' . getNonce() . '" type="text/javascript"> |
|
| 676 | + print '<script nonce="'.getNonce().'" type="text/javascript"> |
|
| 677 | 677 | jQuery(document).ready(function() { |
| 678 | - $("#search_' . $htmlname . '").change(function() { |
|
| 679 | - var obj = ' . json_encode($events) . '; |
|
| 678 | + $("#search_' . $htmlname.'").change(function() { |
|
| 679 | + var obj = ' . json_encode($events).'; |
|
| 680 | 680 | $.each(obj, function(key,values) { |
| 681 | 681 | if (values.method.length) { |
| 682 | - runJsCodeForEvent' . $htmlname . '(values); |
|
| 682 | + runJsCodeForEvent' . $htmlname.'(values); |
|
| 683 | 683 | } |
| 684 | 684 | }); |
| 685 | 685 | |
@@ -687,13 +687,13 @@ discard block |
||
| 687 | 687 | }); |
| 688 | 688 | |
| 689 | 689 | // Function used to execute events when search_htmlname change |
| 690 | - function runJsCodeForEvent' . $htmlname . '(obj) { |
|
| 691 | - var id = $("#' . $htmlname . '").val(); |
|
| 690 | + function runJsCodeForEvent' . $htmlname.'(obj) { |
|
| 691 | + var id = $("#' . $htmlname.'").val(); |
|
| 692 | 692 | var method = obj.method; |
| 693 | 693 | var url = obj.url; |
| 694 | 694 | var htmlname = obj.htmlname; |
| 695 | 695 | var showempty = obj.showempty; |
| 696 | - console.log("Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); |
|
| 696 | + console.log("Run runJsCodeForEvent-' . $htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); |
|
| 697 | 697 | $.getJSON(url, |
| 698 | 698 | { |
| 699 | 699 | action: method, |
@@ -723,9 +723,9 @@ discard block |
||
| 723 | 723 | </script>'; |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - print "\n" . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . "\n"; |
|
| 727 | - print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />'; |
|
| 728 | - print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php', '', $minLength, 0); |
|
| 726 | + print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n"; |
|
| 727 | + print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />'; |
|
| 728 | + print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajax/ajaxcompanies.php', '', $minLength, 0); |
|
| 729 | 729 | return $socid; |
| 730 | 730 | } else { |
| 731 | 731 | // Search to list thirdparties |
@@ -737,14 +737,14 @@ discard block |
||
| 737 | 737 | $sql .= ", s.address, s.zip, s.town"; |
| 738 | 738 | $sql .= ", dictp.code as country_code"; |
| 739 | 739 | } |
| 740 | - $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
| 740 | + $sql .= " FROM ".$this->db->prefix()."societe as s"; |
|
| 741 | 741 | if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { |
| 742 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
| 742 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
| 743 | 743 | } |
| 744 | - $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
| 744 | + $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
|
| 745 | 745 | // For ajax search we limit here. For combo list, we limit later |
| 746 | 746 | if (is_array($limitto) && count($limitto)) { |
| 747 | - $sql .= " AND s.rowid IN (" . $this->db->sanitize(join(',', $limitto)) . ")"; |
|
| 747 | + $sql .= " AND s.rowid IN (".$this->db->sanitize(join(',', $limitto)).")"; |
|
| 748 | 748 | } |
| 749 | 749 | // Add where from hooks |
| 750 | 750 | $parameters = array(); |
@@ -754,10 +754,10 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | $resql = $this->db->query($sql); |
| 756 | 756 | if ($resql) { |
| 757 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"'; |
|
| 757 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'; |
|
| 758 | 758 | if ($conf->use_javascript_ajax) { |
| 759 | - $javaScript = "window.location='" . dol_escape_js($_SERVER['PHP_SELF']) . "?" . $var_id . "=" . ($forceid > 0 ? $forceid : $object->id) . $moreparam . "&" . $htmlname . "=' + form." . $htmlname . ".options[form." . $htmlname . ".selectedIndex].value;"; |
|
| 760 | - print ' onChange="' . $javaScript . '"'; |
|
| 759 | + $javaScript = "window.location='".dol_escape_js($_SERVER['PHP_SELF'])."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;"; |
|
| 760 | + print ' onChange="'.$javaScript.'"'; |
|
| 761 | 761 | } |
| 762 | 762 | print '>'; |
| 763 | 763 | print '<option value="-1"> </option>'; |
@@ -775,18 +775,18 @@ discard block |
||
| 775 | 775 | $disabled = 1; |
| 776 | 776 | } |
| 777 | 777 | if ($selected > 0 && $selected == $obj->rowid) { |
| 778 | - print '<option value="' . $obj->rowid . '"'; |
|
| 778 | + print '<option value="'.$obj->rowid.'"'; |
|
| 779 | 779 | if ($disabled) { |
| 780 | 780 | print ' disabled'; |
| 781 | 781 | } |
| 782 | - print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>'; |
|
| 782 | + print ' selected>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>'; |
|
| 783 | 783 | $firstCompany = $obj->rowid; |
| 784 | 784 | } else { |
| 785 | - print '<option value="' . $obj->rowid . '"'; |
|
| 785 | + print '<option value="'.$obj->rowid.'"'; |
|
| 786 | 786 | if ($disabled) { |
| 787 | 787 | print ' disabled'; |
| 788 | 788 | } |
| 789 | - print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>'; |
|
| 789 | + print '>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>'; |
|
| 790 | 790 | } |
| 791 | 791 | $i++; |
| 792 | 792 | } |
@@ -823,20 +823,20 @@ discard block |
||
| 823 | 823 | if (is_object($object) && method_exists($object, 'liste_type_contact')) { |
| 824 | 824 | $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); |
| 825 | 825 | |
| 826 | - $out .= '<select class="flat valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
| 826 | + $out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
| 827 | 827 | if ($showempty) { |
| 828 | 828 | $out .= '<option value="0"> </option>'; |
| 829 | 829 | } |
| 830 | 830 | foreach ($lesTypes as $key => $value) { |
| 831 | - $out .= '<option value="' . $key . '"'; |
|
| 831 | + $out .= '<option value="'.$key.'"'; |
|
| 832 | 832 | if ($key == $selected) { |
| 833 | 833 | $out .= ' selected'; |
| 834 | 834 | } |
| 835 | - $out .= '>' . $value . '</option>'; |
|
| 835 | + $out .= '>'.$value.'</option>'; |
|
| 836 | 836 | } |
| 837 | 837 | $out .= "</select>"; |
| 838 | 838 | if ($user->admin && empty($forcehidetooltip)) { |
| 839 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 839 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | $out .= ajax_combobox($htmlname); |
@@ -865,9 +865,9 @@ discard block |
||
| 865 | 865 | if ($rendermode === 'view') { |
| 866 | 866 | $toprint = array(); |
| 867 | 867 | foreach ($contact->roles as $key => $val) { |
| 868 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val['label'] . '</li>'; |
|
| 868 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val['label'].'</li>'; |
|
| 869 | 869 | } |
| 870 | - return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 870 | + return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.'"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | if ($rendermode === 'edit') { |
@@ -913,14 +913,14 @@ discard block |
||
| 913 | 913 | |
| 914 | 914 | $size = ''; |
| 915 | 915 | if (!empty($fieldsize)) { |
| 916 | - $size = 'size="' . $fieldsize . '"'; |
|
| 916 | + $size = 'size="'.$fieldsize.'"'; |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
| 920 | - $out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n"; |
|
| 920 | + $out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; |
|
| 921 | 921 | $moreattrib .= ' autocomplete="off"'; |
| 922 | 922 | } |
| 923 | - $out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ($morecss ? ' ' . $morecss : '') . '" type="text"' . ($moreattrib ? ' ' . $moreattrib : '') . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . "\n"; |
|
| 923 | + $out .= '<input id="'.$htmlname.'" class="maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" type="text"'.($moreattrib ? ' '.$moreattrib : '').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n"; |
|
| 924 | 924 | |
| 925 | 925 | return $out; |
| 926 | 926 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | $parameters = array('formlength' => $formlength, 'selected' => $preselected, 'idprof' => $idprof, 'htmlname' => $htmlname, 'country_code' => $country_code); |
| 997 | 997 | $reshook = $hookmanager->executeHooks('getInputIdProf', $parameters); |
| 998 | 998 | if (empty($reshook)) { |
| 999 | - $out .= '<input type="text" ' . ($morecss ? 'class="' . $morecss . '" ' : '') . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">'; |
|
| 999 | + $out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">'; |
|
| 1000 | 1000 | } |
| 1001 | 1001 | $out .= $hookmanager->resPrint; |
| 1002 | 1002 | |
@@ -1027,9 +1027,9 @@ discard block |
||
| 1027 | 1027 | $i = 0; |
| 1028 | 1028 | while ($i < $nbvalues) { |
| 1029 | 1029 | if ($selected == $valors[$i]) { |
| 1030 | - print '<option value="' . $valors[$i] . '" selected>'; |
|
| 1030 | + print '<option value="'.$valors[$i].'" selected>'; |
|
| 1031 | 1031 | } else { |
| 1032 | - print '<option value="' . $valors[$i] . '">'; |
|
| 1032 | + print '<option value="'.$valors[$i].'">'; |
|
| 1033 | 1033 | } |
| 1034 | 1034 | print $valors[$i]; |
| 1035 | 1035 | print '</option>'; |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | return ''; |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | - $out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">'; |
|
| 1061 | + $out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">'; |
|
| 1062 | 1062 | if ($typeinput == 'form') { |
| 1063 | 1063 | if ($allowempty || ($selected == '' || $selected == '-1')) { |
| 1064 | 1064 | $out .= '<option value="-1">'; |
@@ -1070,33 +1070,33 @@ discard block |
||
| 1070 | 1070 | $out .= '</option>'; |
| 1071 | 1071 | } |
| 1072 | 1072 | if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { |
| 1073 | - $out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>'; |
|
| 1073 | + $out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; |
|
| 1074 | 1074 | } |
| 1075 | 1075 | if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { |
| 1076 | - $out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; |
|
| 1076 | + $out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { |
| 1079 | - $out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
| 1079 | + $out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
| 1080 | 1080 | } |
| 1081 | - $out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>'; |
|
| 1081 | + $out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>'; |
|
| 1082 | 1082 | } elseif ($typeinput == 'list') { |
| 1083 | - $out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '> </option>'; |
|
| 1083 | + $out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'> </option>'; |
|
| 1084 | 1084 | if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { |
| 1085 | - $out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>'; |
|
| 1085 | + $out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; |
|
| 1086 | 1086 | } |
| 1087 | 1087 | if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { |
| 1088 | - $out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
| 1088 | + $out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
| 1089 | 1089 | } |
| 1090 | 1090 | if (isModEnabled("fournisseur")) { |
| 1091 | - $out .= '<option value="4"' . ($selected == '4' ? ' selected' : '') . '>' . $langs->trans('Supplier') . '</option>'; |
|
| 1091 | + $out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>'; |
|
| 1092 | 1092 | } |
| 1093 | - $out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>'; |
|
| 1093 | + $out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>'; |
|
| 1094 | 1094 | } elseif ($typeinput == 'admin') { |
| 1095 | 1095 | if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { |
| 1096 | - $out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; |
|
| 1096 | + $out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
| 1097 | 1097 | } |
| 1098 | 1098 | if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { |
| 1099 | - $out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
| 1099 | + $out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
| 1100 | 1100 | } |
| 1101 | 1101 | } |
| 1102 | 1102 | $out .= '</select>'; |
@@ -1122,12 +1122,12 @@ discard block |
||
| 1122 | 1122 | |
| 1123 | 1123 | $out = ''; |
| 1124 | 1124 | if ($htmlname != "none") { |
| 1125 | - $out .= '<form method="post" action="' . $page . '">'; |
|
| 1125 | + $out .= '<form method="post" action="'.$page.'">'; |
|
| 1126 | 1126 | $out .= '<input type="hidden" name="action" value="set_thirdpartytype">'; |
| 1127 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 1127 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 1128 | 1128 | $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. |
| 1129 | 1129 | $out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); |
| 1130 | - $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
| 1130 | + $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
| 1131 | 1131 | $out .= '</form>'; |
| 1132 | 1132 | } else { |
| 1133 | 1133 | if ($selected > 0) { |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | |
| 1167 | 1167 | //print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']); |
| 1168 | 1168 | print img_action('', $actioncode, $actionpicto, 'class="inline-block valignmiddle paddingright pictoprospectstatus"'); |
| 1169 | - print '<select class="flat selectprospectstatus maxwidth150" id="'. $htmlname.$idprospect .'" data-socid="'.$idprospect.'" name="' . $htmlname .'">'; |
|
| 1169 | + print '<select class="flat selectprospectstatus maxwidth150" id="'.$htmlname.$idprospect.'" data-socid="'.$idprospect.'" name="'.$htmlname.'">'; |
|
| 1170 | 1170 | foreach ($prospectstatic->cacheprospectstatus as $key => $val) { |
| 1171 | 1171 | $titlealt = (empty($val['label']) ? 'default' : $val['label']); |
| 1172 | 1172 | $label = $val['label']; |
@@ -1192,8 +1192,8 @@ discard block |
||
| 1192 | 1192 | var image = $(this).prev(".pictoprospectstatus"); |
| 1193 | 1193 | $.ajax({ |
| 1194 | 1194 | type: "POST", |
| 1195 | - url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\', |
|
| 1196 | - data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\' }, |
|
| 1195 | + url: \'' . DOL_URL_ROOT.'/core/ajax/ajaxstatusprospect.php\', |
|
| 1196 | + data: { id: statusid, prospectid: prospectid, token: \''. newToken().'\', action: \'updatestatusprospect\' }, |
|
| 1197 | 1197 | success: function(response) { |
| 1198 | 1198 | console.log(response.img); |
| 1199 | 1199 | image.replaceWith(response.img); |
@@ -275,19 +275,19 @@ discard block |
||
| 275 | 275 | // Show message if accountancy hidden options are activated to help to resolve some problems |
| 276 | 276 | if (!$user->admin) { |
| 277 | 277 | if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
| 278 | - print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>'; |
|
| 278 | + print '<div class="info">'.$langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS").'</div>'; |
|
| 279 | 279 | } |
| 280 | 280 | if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { |
| 281 | - print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>'; |
|
| 281 | + print '<div class="info">'.$langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS").'</div>'; |
|
| 282 | 282 | } |
| 283 | 283 | if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { |
| 284 | - print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>'; |
|
| 284 | + print '<div class="info">'.$langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY").'</div>'; |
|
| 285 | 285 | } |
| 286 | 286 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
| 287 | - print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED") . '</div>'; |
|
| 287 | + print '<div class="info">'.$langs->trans("ConstantIsOn", "MAIN_COMPANY_PERENTITY_SHARED").'</div>'; |
|
| 288 | 288 | } |
| 289 | 289 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 290 | - print '<div class="info">' . $langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED") . '</div>'; |
|
| 290 | + print '<div class="info">'.$langs->trans("ConstantIsOn", "MAIN_PRODUCT_PERENTITY_SHARED").'</div>'; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | // Advanced params |
| 460 | 460 | print '<table class="noborder centpercent">'; |
| 461 | 461 | print '<tr class="liste_titre">'; |
| 462 | -print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>'; |
|
| 462 | +print '<td colspan="2">'.$langs->trans('OptionsAdvanced').'</td>'; |
|
| 463 | 463 | print "</tr>\n"; |
| 464 | 464 | |
| 465 | 465 | print '<tr class="oddeven">'; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | // Number of letters for lettering (3 by default (AAA), min 2 (AA)) |
| 481 | 481 | print '<tr class="oddeven">'; |
| 482 | 482 | print '<td>'; |
| 483 | - print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")) . '</td>'; |
|
| 483 | + print $form->textwithpicto($langs->trans("ACCOUNTING_LETTERING_NBLETTERS"), $langs->trans("ACCOUNTING_LETTERING_NBLETTERS_DESC")).'</td>'; |
|
| 484 | 484 | print '<td class="right">'; |
| 485 | 485 | |
| 486 | 486 | if (empty($letter)) { |
@@ -491,19 +491,19 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | - print '<input class="flat" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter . '" type="number" step="1" min="2" max="3" >' . "\n"; |
|
| 494 | + print '<input class="flat" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="'.$nbletter.'" type="number" step="1" min="2" max="3" >'."\n"; |
|
| 495 | 495 | print '</tr>'; |
| 496 | 496 | |
| 497 | 497 | // Auto Lettering when transfer in accountancy is realized |
| 498 | 498 | print '<tr class="oddeven">'; |
| 499 | 499 | print '<td>'; |
| 500 | - print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>'; |
|
| 500 | + print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")).'</td>'; |
|
| 501 | 501 | if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) { |
| 502 | - print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">'; |
|
| 502 | + print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenableautolettering&value=0">'; |
|
| 503 | 503 | print img_picto($langs->trans("Activated"), 'switch_on'); |
| 504 | 504 | print '</a></td>'; |
| 505 | 505 | } else { |
| 506 | - print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">'; |
|
| 506 | + print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenableautolettering&value=1">'; |
|
| 507 | 507 | print img_picto($langs->trans("Disabled"), 'switch_off'); |
| 508 | 508 | print '</a></td>'; |
| 509 | 509 | } |
@@ -514,11 +514,11 @@ discard block |
||
| 514 | 514 | print '<td>'; |
| 515 | 515 | print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>'; |
| 516 | 516 | if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { |
| 517 | - print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">'; |
|
| 517 | + print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablevatreversecharge&value=0">'; |
|
| 518 | 518 | print img_picto($langs->trans("Activated"), 'switch_on'); |
| 519 | 519 | print '</a></td>'; |
| 520 | 520 | } else { |
| 521 | - print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">'; |
|
| 521 | + print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablevatreversecharge&value=1">'; |
|
| 522 | 522 | print img_picto($langs->trans("Disabled"), 'switch_off'); |
| 523 | 523 | print '</a></td>'; |
| 524 | 524 | } |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | $lettre = str_pad("", getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS', 3), "A"); |
| 294 | 294 | |
| 295 | 295 | $sql = "SELECT DISTINCT ab2.lettering_code"; |
| 296 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
| 297 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account"; |
|
| 298 | - $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")"; |
|
| 299 | - $sql .= " AND ab2.lettering_code != ''"; |
|
| 300 | - $sql .= " ORDER BY ab2.lettering_code DESC"; |
|
| 301 | - $sql .= " LIMIT 1 "; |
|
| 296 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
| 297 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account"; |
|
| 298 | + $sql .= " WHERE ab.rowid IN (".$this->db->sanitize(implode(',', $ids)).")"; |
|
| 299 | + $sql .= " AND ab2.lettering_code != ''"; |
|
| 300 | + $sql .= " ORDER BY ab2.lettering_code DESC"; |
|
| 301 | + $sql .= " LIMIT 1 "; |
|
| 302 | 302 | |
| 303 | 303 | $resqla = $this->db->query($sql); |
| 304 | 304 | if ($resqla) { |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | public function bookkeepingLetteringAll($bookkeeping_ids, $unlettering = false) |
| 406 | 406 | { |
| 407 | - dol_syslog(__METHOD__ . " - ", LOG_DEBUG); |
|
| 407 | + dol_syslog(__METHOD__." - ", LOG_DEBUG); |
|
| 408 | 408 | |
| 409 | 409 | $error = 0; |
| 410 | 410 | $errors = array(); |
@@ -521,25 +521,25 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | // Get all bookkeeping lines |
| 523 | 523 | $sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc"; |
| 524 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
| 525 | - $sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")"; |
|
| 524 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
| 525 | + $sql .= " WHERE ab.entity IN (".getEntity('accountancy').")"; |
|
| 526 | 526 | $sql .= " AND ab.fk_doc > 0"; |
| 527 | 527 | if (!empty($bookkeeping_ids)) { |
| 528 | 528 | // Get all bookkeeping lines of piece number |
| 529 | 529 | $sql .= " AND EXISTS ("; |
| 530 | 530 | $sql .= " SELECT rowid"; |
| 531 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn"; |
|
| 532 | - $sql .= " WHERE pn.entity IN (" . getEntity('accountancy') . ")"; |
|
| 533 | - $sql .= " AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")"; |
|
| 531 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS pn"; |
|
| 532 | + $sql .= " WHERE pn.entity IN (".getEntity('accountancy').")"; |
|
| 533 | + $sql .= " AND pn.rowid IN (".$this->db->sanitize(implode(',', $bookkeeping_ids)).")"; |
|
| 534 | 534 | $sql .= " AND pn.piece_num = ab.piece_num"; |
| 535 | 535 | $sql .= " )"; |
| 536 | 536 | } |
| 537 | 537 | if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
| 538 | 538 | |
| 539 | - dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG); |
|
| 539 | + dol_syslog(__METHOD__." - Get all bookkeeping lines", LOG_DEBUG); |
|
| 540 | 540 | $resql = $this->db->query($sql); |
| 541 | 541 | if (!$resql) { |
| 542 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 542 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 543 | 543 | return -1; |
| 544 | 544 | } |
| 545 | 545 | |
@@ -586,34 +586,34 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | // Get all bookkeeping lines linked |
| 588 | 588 | $sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.debit, ab.credit, ab.lettering_code"; |
| 589 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; |
|
| 590 | - $sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")"; |
|
| 589 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab"; |
|
| 590 | + $sql .= " WHERE ab.entity IN (".getEntity('accountancy').")"; |
|
| 591 | 591 | $sql .= " AND ("; |
| 592 | 592 | if (!empty($bank_ids)) { |
| 593 | 593 | $sql .= " EXISTS ("; |
| 594 | 594 | $sql .= " SELECT bpn.rowid"; |
| 595 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS bpn"; |
|
| 596 | - $sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")"; |
|
| 595 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS bpn"; |
|
| 596 | + $sql .= " WHERE bpn.entity IN (".getEntity('accountancy').")"; |
|
| 597 | 597 | $sql .= " AND bpn.doc_type = 'bank'"; |
| 598 | - $sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")"; |
|
| 598 | + $sql .= " AND bpn.fk_doc IN (".$this->db->sanitize(implode(',', $bank_ids)).")"; |
|
| 599 | 599 | $sql .= " AND bpn.piece_num = ab.piece_num"; |
| 600 | 600 | $sql .= " ) OR "; |
| 601 | 601 | } |
| 602 | 602 | $sql .= " EXISTS ("; |
| 603 | 603 | $sql .= " SELECT dpn.rowid"; |
| 604 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS dpn"; |
|
| 605 | - $sql .= " WHERE dpn.entity IN (" . getEntity('accountancy') . ")"; |
|
| 606 | - $sql .= " AND dpn.doc_type = '" . $this->db->escape($doc_type) . "'"; |
|
| 607 | - $sql .= " AND dpn.fk_doc IN (" . $this->db->sanitize(implode(',', $doc_ids)) . ")"; |
|
| 604 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS dpn"; |
|
| 605 | + $sql .= " WHERE dpn.entity IN (".getEntity('accountancy').")"; |
|
| 606 | + $sql .= " AND dpn.doc_type = '".$this->db->escape($doc_type)."'"; |
|
| 607 | + $sql .= " AND dpn.fk_doc IN (".$this->db->sanitize(implode(',', $doc_ids)).")"; |
|
| 608 | 608 | $sql .= " AND dpn.piece_num = ab.piece_num"; |
| 609 | 609 | $sql .= " )"; |
| 610 | 610 | $sql .= ")"; |
| 611 | 611 | if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
| 612 | 612 | |
| 613 | - dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG); |
|
| 613 | + dol_syslog(__METHOD__." - Get all bookkeeping lines linked", LOG_DEBUG); |
|
| 614 | 614 | $resql = $this->db->query($sql); |
| 615 | 615 | if (!$resql) { |
| 616 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 616 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 617 | 617 | return -1; |
| 618 | 618 | } |
| 619 | 619 | |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | public function getDocTypeAndFkDocFromBankLines($bank_ids) |
| 646 | 646 | { |
| 647 | - dol_syslog(__METHOD__ . " - bank_ids=".json_encode($bank_ids), LOG_DEBUG); |
|
| 647 | + dol_syslog(__METHOD__." - bank_ids=".json_encode($bank_ids), LOG_DEBUG); |
|
| 648 | 648 | |
| 649 | 649 | // Clean parameters |
| 650 | 650 | $bank_ids = is_array($bank_ids) ? $bank_ids : array(); |
@@ -656,16 +656,16 @@ discard block |
||
| 656 | 656 | $bookkeeping_lines_by_type = array(); |
| 657 | 657 | foreach (self::$doc_type_infos as $doc_type => $doc_type_info) { |
| 658 | 658 | // Get all fk_doc by doc_type from bank ids |
| 659 | - $sql = "SELECT DISTINCT dp." . $doc_type_info['doc_payment_table_fk_doc'] . " AS fk_doc"; |
|
| 660 | - $sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p"; |
|
| 661 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid"; |
|
| 662 | - $sql .= " WHERE p." . $doc_type_info['payment_table_fk_bank'] . " IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")"; |
|
| 663 | - $sql .= " AND dp." . $doc_type_info['doc_payment_table_fk_doc'] . " > 0"; |
|
| 659 | + $sql = "SELECT DISTINCT dp.".$doc_type_info['doc_payment_table_fk_doc']." AS fk_doc"; |
|
| 660 | + $sql .= " FROM ".MAIN_DB_PREFIX.$doc_type_info['payment_table']." AS p"; |
|
| 661 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$doc_type_info['doc_payment_table']." AS dp ON dp.".$doc_type_info['doc_payment_table_fk_payment']." = p.rowid"; |
|
| 662 | + $sql .= " WHERE p.".$doc_type_info['payment_table_fk_bank']." IN (".$this->db->sanitize(implode(',', $bank_ids)).")"; |
|
| 663 | + $sql .= " AND dp.".$doc_type_info['doc_payment_table_fk_doc']." > 0"; |
|
| 664 | 664 | |
| 665 | - dol_syslog(__METHOD__ . " - Get all fk_doc by doc_type from list of bank ids for '" . $doc_type . "'", LOG_DEBUG); |
|
| 665 | + dol_syslog(__METHOD__." - Get all fk_doc by doc_type from list of bank ids for '".$doc_type."'", LOG_DEBUG); |
|
| 666 | 666 | $resql = $this->db->query($sql); |
| 667 | 667 | if (!$resql) { |
| 668 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 668 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 669 | 669 | return -1; |
| 670 | 670 | } |
| 671 | 671 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | { |
| 690 | 690 | global $langs; |
| 691 | 691 | |
| 692 | - dol_syslog(__METHOD__ . " - bank_ids=".json_encode($document_ids) . ", doc_type=$doc_type", LOG_DEBUG); |
|
| 692 | + dol_syslog(__METHOD__." - bank_ids=".json_encode($document_ids).", doc_type=$doc_type", LOG_DEBUG); |
|
| 693 | 693 | |
| 694 | 694 | // Clean parameters |
| 695 | 695 | $document_ids = is_array($document_ids) ? $document_ids : array(); |
@@ -711,16 +711,16 @@ discard block |
||
| 711 | 711 | $bank_ids = array(); |
| 712 | 712 | |
| 713 | 713 | // Get all fk_doc by doc_type from bank ids |
| 714 | - $sql = "SELECT DISTINCT p." . $doc_type_info['payment_table_fk_bank'] . " AS fk_doc"; |
|
| 715 | - $sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p"; |
|
| 716 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid"; |
|
| 717 | - $sql .= " WHERE dp." . $doc_type_info['doc_payment_table_fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")"; |
|
| 718 | - $sql .= " AND p." . $doc_type_info['payment_table_fk_bank'] . " > 0"; |
|
| 714 | + $sql = "SELECT DISTINCT p.".$doc_type_info['payment_table_fk_bank']." AS fk_doc"; |
|
| 715 | + $sql .= " FROM ".MAIN_DB_PREFIX.$doc_type_info['payment_table']." AS p"; |
|
| 716 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$doc_type_info['doc_payment_table']." AS dp ON dp.".$doc_type_info['doc_payment_table_fk_payment']." = p.rowid"; |
|
| 717 | + $sql .= " WHERE dp.".$doc_type_info['doc_payment_table_fk_doc']." IN (".$this->db->sanitize(implode(',', $document_ids)).")"; |
|
| 718 | + $sql .= " AND p.".$doc_type_info['payment_table_fk_bank']." > 0"; |
|
| 719 | 719 | |
| 720 | - dol_syslog(__METHOD__ . " - Get all bank ids from list of document ids of a type '" . $doc_type . "'", LOG_DEBUG); |
|
| 720 | + dol_syslog(__METHOD__." - Get all bank ids from list of document ids of a type '".$doc_type."'", LOG_DEBUG); |
|
| 721 | 721 | $resql = $this->db->query($sql); |
| 722 | 722 | if (!$resql) { |
| 723 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 723 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 724 | 724 | return -1; |
| 725 | 725 | } |
| 726 | 726 | |
@@ -766,15 +766,15 @@ discard block |
||
| 766 | 766 | $link_by_element = array(); |
| 767 | 767 | $element_by_link = array(); |
| 768 | 768 | foreach ($doc_type_info['linked_info'] as $linked_info) { |
| 769 | - $sql = "SELECT DISTINCT tl2." . $linked_info['fk_link'] . " AS fk_link, tl2." . $linked_info['fk_doc'] . " AS fk_doc"; |
|
| 770 | - $sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl"; |
|
| 771 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl2 ON tl2." . $linked_info['fk_link'] . " = tl." . $linked_info['fk_link']; |
|
| 772 | - $sql .= " WHERE tl." . $linked_info['fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")"; |
|
| 769 | + $sql = "SELECT DISTINCT tl2.".$linked_info['fk_link']." AS fk_link, tl2.".$linked_info['fk_doc']." AS fk_doc"; |
|
| 770 | + $sql .= " FROM ".MAIN_DB_PREFIX.$linked_info['table']." AS tl"; |
|
| 771 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$linked_info['table']." AS tl2 ON tl2.".$linked_info['fk_link']." = tl.".$linked_info['fk_link']; |
|
| 772 | + $sql .= " WHERE tl.".$linked_info['fk_doc']." IN (".$this->db->sanitize(implode(',', $document_ids)).")"; |
|
| 773 | 773 | |
| 774 | - dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG); |
|
| 774 | + dol_syslog(__METHOD__." - Get document lines", LOG_DEBUG); |
|
| 775 | 775 | $resql = $this->db->query($sql); |
| 776 | 776 | if (!$resql) { |
| 777 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 777 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 778 | 778 | return -1; |
| 779 | 779 | } |
| 780 | 780 | |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | while ($obj = $this->db->fetch_object($resql)) { |
| 783 | 783 | $current_document_ids[$obj->fk_doc] = $obj->fk_doc; |
| 784 | 784 | |
| 785 | - $link_key = $linked_info['prefix'] . $obj->fk_link; |
|
| 785 | + $link_key = $linked_info['prefix'].$obj->fk_link; |
|
| 786 | 786 | $element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc; |
| 787 | 787 | $link_by_element[$obj->fk_doc][$link_key] = $link_key; |
| 788 | 788 | if ($is_fk_link_is_also_fk_doc) { |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | // Read the permissions of a user inherited by its groups |
| 220 | 220 | $permsgroupbyentity = array(); |
| 221 | 221 | |
| 222 | -$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group |
|
| 222 | +$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group |
|
| 223 | 223 | $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; |
| 224 | -$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user |
|
| 224 | +$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user |
|
| 225 | 225 | $sql .= " WHERE gr.entity = ".((int) $entity); |
| 226 | 226 | $sql .= " AND gu.entity =".((int) $entity); |
| 227 | 227 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | } else { |
| 499 | 499 | $ishidden = 0; |
| 500 | 500 | } |
| 501 | - $isexpanded = ! $ishidden; |
|
| 501 | + $isexpanded = !$ishidden; |
|
| 502 | 502 | //var_dump("isexpanded=".$isexpanded); |
| 503 | 503 | |
| 504 | 504 | $permsgroupbyentitypluszero = array(); |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } else { |
| 523 | 523 | $ishidden = 0; |
| 524 | 524 | } |
| 525 | - $isexpanded = ! $ishidden; |
|
| 525 | + $isexpanded = !$ishidden; |
|
| 526 | 526 | //var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded); |
| 527 | 527 | |
| 528 | 528 | // Break detected, we get objMod |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public static function setUpBeforeClass(): void |
| 50 | 50 | { |
| 51 | 51 | // Make sure we backup and remove the configuration file to force new install. |
| 52 | - @rename('htdocs/conf/conf.php', sys_get_temp_dir() . '/conf.php'); |
|
| 52 | + @rename('htdocs/conf/conf.php', sys_get_temp_dir().'/conf.php'); |
|
| 53 | 53 | |
| 54 | 54 | // Start without a database |
| 55 | 55 | self::dropTestDatabase(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | protected static function dropTestDatabase() |
| 67 | 67 | { |
| 68 | 68 | $mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass); |
| 69 | - $mysqli->query("DROP DATABASE " . self::$db_name); |
|
| 69 | + $mysqli->query("DROP DATABASE ".self::$db_name); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | // Remove the generated configuration and restore the backed up file. |
| 80 | 80 | @unlink('htdocs/conf/conf.php'); |
| 81 | - @rename(sys_get_temp_dir() . '/conf.php', 'htdocs/conf/conf.php'); |
|
| 81 | + @rename(sys_get_temp_dir().'/conf.php', 'htdocs/conf/conf.php'); |
|
| 82 | 82 | |
| 83 | 83 | // Cleanup test database |
| 84 | 84 | self::dropTestDatabase(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // FIXME: the button itself should have an ID |
| 221 | 221 | $this->byId('nextbutton')->byTag('input')->click(); |
| 222 | 222 | $time = $start->diff(new DateTimeImmutable()); |
| 223 | - echo "\nPopulating the database took " . $time->format("%s seconds.\n"); |
|
| 223 | + echo "\nPopulating the database took ".$time->format("%s seconds.\n"); |
|
| 224 | 224 | $this->assertStringContainsString('/install/step2.php', $this->url()); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * \remarks To run this script as CLI: phpunit filename.php |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | -global $conf,$user,$langs,$db; |
|
| 27 | +global $conf, $user, $langs, $db; |
|
| 28 | 28 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 29 | 29 | //require_once 'PHPUnit/Autoload.php'; |
| 30 | 30 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $user->fetch(1); |
| 37 | 37 | $user->getrights(); |
| 38 | 38 | } |
| 39 | -$conf->global->MAIN_DISABLE_ALL_MAILS=1; |
|
| 39 | +$conf->global->MAIN_DISABLE_ALL_MAILS = 1; |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | parent::__construct($name); |
| 66 | 66 | |
| 67 | 67 | //$this->sharedFixture |
| 68 | - global $conf,$user,$langs,$db; |
|
| 69 | - $this->savconf=$conf; |
|
| 70 | - $this->savuser=$user; |
|
| 71 | - $this->savlangs=$langs; |
|
| 72 | - $this->savdb=$db; |
|
| 68 | + global $conf, $user, $langs, $db; |
|
| 69 | + $this->savconf = $conf; |
|
| 70 | + $this->savuser = $user; |
|
| 71 | + $this->savlangs = $langs; |
|
| 72 | + $this->savdb = $db; |
|
| 73 | 73 | |
| 74 | 74 | print __METHOD__." db->type=".$db->type." user->id=".$user->id; |
| 75 | 75 | //print " - db ".$db->db; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public static function setUpBeforeClass(): void |
| 85 | 85 | { |
| 86 | - global $conf,$user,$langs,$db; |
|
| 86 | + global $conf, $user, $langs, $db; |
|
| 87 | 87 | |
| 88 | 88 | if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { |
| 89 | 89 | print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(1); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | print "\n".__METHOD__." default language of company must be set to autodetect.\n"; die(1); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
| 100 | + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
|
| 101 | 101 | |
| 102 | 102 | print __METHOD__."\n"; |
| 103 | 103 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public static function tearDownAfterClass(): void |
| 111 | 111 | { |
| 112 | - global $conf,$user,$langs,$db; |
|
| 112 | + global $conf, $user, $langs, $db; |
|
| 113 | 113 | $db->rollback(); |
| 114 | 114 | |
| 115 | 115 | print __METHOD__."\n"; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | protected function setUp(): void |
| 124 | 124 | { |
| 125 | - global $conf,$user,$langs,$db; |
|
| 126 | - $conf=$this->savconf; |
|
| 127 | - $user=$this->savuser; |
|
| 128 | - $langs=$this->savlangs; |
|
| 129 | - $db=$this->savdb; |
|
| 125 | + global $conf, $user, $langs, $db; |
|
| 126 | + $conf = $this->savconf; |
|
| 127 | + $user = $this->savuser; |
|
| 128 | + $langs = $this->savlangs; |
|
| 129 | + $db = $this->savdb; |
|
| 130 | 130 | |
| 131 | 131 | print __METHOD__."\n"; |
| 132 | 132 | } |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function testSocieteCreate() |
| 150 | 150 | { |
| 151 | - global $conf,$user,$langs,$db; |
|
| 152 | - $conf=$this->savconf; |
|
| 153 | - $user=$this->savuser; |
|
| 154 | - $langs=$this->savlangs; |
|
| 155 | - $db=$this->savdb; |
|
| 151 | + global $conf, $user, $langs, $db; |
|
| 152 | + $conf = $this->savconf; |
|
| 153 | + $user = $this->savuser; |
|
| 154 | + $langs = $this->savlangs; |
|
| 155 | + $db = $this->savdb; |
|
| 156 | 156 | |
| 157 | - $localobject=new Societe($db); |
|
| 157 | + $localobject = new Societe($db); |
|
| 158 | 158 | $localobject->initAsSpecimen(); |
| 159 | - $result=$localobject->create($user); |
|
| 159 | + $result = $localobject->create($user); |
|
| 160 | 160 | |
| 161 | 161 | print __METHOD__." result=".$result."\n"; |
| 162 | 162 | $this->assertLessThanOrEqual($result, 0); |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function testSocieteFetch($id) |
| 177 | 177 | { |
| 178 | - global $conf,$user,$langs,$db; |
|
| 179 | - $conf=$this->savconf; |
|
| 180 | - $user=$this->savuser; |
|
| 181 | - $langs=$this->savlangs; |
|
| 182 | - $db=$this->savdb; |
|
| 183 | - |
|
| 184 | - $localobject=new Societe($db); |
|
| 185 | - $result=$localobject->fetch($id); |
|
| 178 | + global $conf, $user, $langs, $db; |
|
| 179 | + $conf = $this->savconf; |
|
| 180 | + $user = $this->savuser; |
|
| 181 | + $langs = $this->savlangs; |
|
| 182 | + $db = $this->savdb; |
|
| 183 | + |
|
| 184 | + $localobject = new Societe($db); |
|
| 185 | + $result = $localobject->fetch($id); |
|
| 186 | 186 | print __METHOD__." id=".$id." result=".$result."\n"; |
| 187 | 187 | $this->assertLessThan($result, 0); |
| 188 | 188 | |
| 189 | - $result=$localobject->verify(); |
|
| 189 | + $result = $localobject->verify(); |
|
| 190 | 190 | print __METHOD__." id=".$id." result=".$result."\n"; |
| 191 | 191 | $this->assertEquals($result, 0); |
| 192 | 192 | |
@@ -204,43 +204,43 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function testSocieteUpdate($localobject) |
| 206 | 206 | { |
| 207 | - global $conf,$user,$langs,$db; |
|
| 208 | - $conf=$this->savconf; |
|
| 209 | - $user=$this->savuser; |
|
| 210 | - $langs=$this->savlangs; |
|
| 211 | - $db=$this->savdb; |
|
| 212 | - |
|
| 213 | - $localobject->note_private='New private note after update'; |
|
| 214 | - $localobject->note_public='New public note after update'; |
|
| 215 | - $localobject->name='New name'; |
|
| 216 | - $localobject->address='New address'; |
|
| 217 | - $localobject->zip='New zip'; |
|
| 218 | - $localobject->town='New town'; |
|
| 219 | - $localobject->country_id=2; |
|
| 220 | - $localobject->status=0; |
|
| 221 | - $localobject->phone='New tel'; |
|
| 222 | - $localobject->fax='New fax'; |
|
| 223 | - $localobject->email='[email protected]'; |
|
| 224 | - $localobject->url='New url'; |
|
| 225 | - $localobject->idprof1='new idprof1'; |
|
| 226 | - $localobject->idprof2='new idprof2'; |
|
| 227 | - $localobject->idprof3='new idprof3'; |
|
| 228 | - $localobject->idprof4='new idprof4'; |
|
| 229 | - |
|
| 230 | - $result=$localobject->update($localobject->id, $user); |
|
| 207 | + global $conf, $user, $langs, $db; |
|
| 208 | + $conf = $this->savconf; |
|
| 209 | + $user = $this->savuser; |
|
| 210 | + $langs = $this->savlangs; |
|
| 211 | + $db = $this->savdb; |
|
| 212 | + |
|
| 213 | + $localobject->note_private = 'New private note after update'; |
|
| 214 | + $localobject->note_public = 'New public note after update'; |
|
| 215 | + $localobject->name = 'New name'; |
|
| 216 | + $localobject->address = 'New address'; |
|
| 217 | + $localobject->zip = 'New zip'; |
|
| 218 | + $localobject->town = 'New town'; |
|
| 219 | + $localobject->country_id = 2; |
|
| 220 | + $localobject->status = 0; |
|
| 221 | + $localobject->phone = 'New tel'; |
|
| 222 | + $localobject->fax = 'New fax'; |
|
| 223 | + $localobject->email = '[email protected]'; |
|
| 224 | + $localobject->url = 'New url'; |
|
| 225 | + $localobject->idprof1 = 'new idprof1'; |
|
| 226 | + $localobject->idprof2 = 'new idprof2'; |
|
| 227 | + $localobject->idprof3 = 'new idprof3'; |
|
| 228 | + $localobject->idprof4 = 'new idprof4'; |
|
| 229 | + |
|
| 230 | + $result = $localobject->update($localobject->id, $user); |
|
| 231 | 231 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 232 | 232 | $this->assertLessThan($result, 0); |
| 233 | 233 | |
| 234 | - $result=$localobject->update_note($localobject->note_private, '_private'); |
|
| 234 | + $result = $localobject->update_note($localobject->note_private, '_private'); |
|
| 235 | 235 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 236 | 236 | $this->assertLessThan($result, 0, 'Holiday::update_note (private) error'); |
| 237 | 237 | |
| 238 | - $result=$localobject->update_note($localobject->note_public, '_public'); |
|
| 238 | + $result = $localobject->update_note($localobject->note_public, '_public'); |
|
| 239 | 239 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 240 | 240 | $this->assertLessThan($result, 0, 'Holiday::update_note (public) error'); |
| 241 | 241 | |
| 242 | - $newobject=new Societe($db); |
|
| 243 | - $result=$newobject->fetch($localobject->id); |
|
| 242 | + $newobject = new Societe($db); |
|
| 243 | + $result = $newobject->fetch($localobject->id); |
|
| 244 | 244 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 245 | 245 | $this->assertLessThan($result, 0); |
| 246 | 246 | |
@@ -277,42 +277,42 @@ discard block |
||
| 277 | 277 | public function testIdProfCheck($localobject) |
| 278 | 278 | { |
| 279 | 279 | // OK FR |
| 280 | - $localobject->country_code='FR'; |
|
| 281 | - $localobject->idprof1=493861496; |
|
| 282 | - $localobject->idprof2=49386149600021; |
|
| 283 | - $result=$localobject->id_prof_check(1, $localobject); // Must be > 0 |
|
| 280 | + $localobject->country_code = 'FR'; |
|
| 281 | + $localobject->idprof1 = 493861496; |
|
| 282 | + $localobject->idprof2 = 49386149600021; |
|
| 283 | + $result = $localobject->id_prof_check(1, $localobject); // Must be > 0 |
|
| 284 | 284 | print __METHOD__." OK FR idprof1 result=".$result."\n"; |
| 285 | 285 | $this->assertGreaterThanOrEqual(1, $result); |
| 286 | - $result=$localobject->id_prof_check(2, $localobject); // Must be > 0 |
|
| 286 | + $result = $localobject->id_prof_check(2, $localobject); // Must be > 0 |
|
| 287 | 287 | print __METHOD__." OK FR idprof2 result=".$result."\n"; |
| 288 | 288 | $this->assertGreaterThanOrEqual(1, $result); |
| 289 | 289 | |
| 290 | 290 | // KO FR |
| 291 | - $localobject->country_code='FR'; |
|
| 292 | - $localobject->idprof1='id1ko'; |
|
| 293 | - $localobject->idprof2='id2ko'; |
|
| 294 | - $result=$localobject->id_prof_check(1, $localobject); // Must be <= 0 |
|
| 291 | + $localobject->country_code = 'FR'; |
|
| 292 | + $localobject->idprof1 = 'id1ko'; |
|
| 293 | + $localobject->idprof2 = 'id2ko'; |
|
| 294 | + $result = $localobject->id_prof_check(1, $localobject); // Must be <= 0 |
|
| 295 | 295 | print __METHOD__." KO FR idprof1 result=".$result."\n"; |
| 296 | 296 | $this->assertLessThan(1, $result); |
| 297 | - $result=$localobject->id_prof_check(2, $localobject); // Must be <= 0 |
|
| 297 | + $result = $localobject->id_prof_check(2, $localobject); // Must be <= 0 |
|
| 298 | 298 | print __METHOD__." KO FR idprof2 result=".$result."\n"; |
| 299 | 299 | $this->assertLessThan(1, $result); |
| 300 | 300 | |
| 301 | 301 | // KO ES |
| 302 | - $localobject->country_code='ES'; |
|
| 303 | - $localobject->idprof1='id1ko'; |
|
| 304 | - $result=$localobject->id_prof_check(1, $localobject); // Must be <= 0 |
|
| 302 | + $localobject->country_code = 'ES'; |
|
| 303 | + $localobject->idprof1 = 'id1ko'; |
|
| 304 | + $result = $localobject->id_prof_check(1, $localobject); // Must be <= 0 |
|
| 305 | 305 | print __METHOD__." KO ES idprof1 result=".$result."\n"; |
| 306 | 306 | $this->assertLessThan(1, $result); |
| 307 | 307 | |
| 308 | 308 | // OK AR |
| 309 | - $localobject->country_code='AR'; |
|
| 310 | - $localobject->idprof1='id1ko'; |
|
| 311 | - $localobject->idprof2='id2ko'; |
|
| 312 | - $result=$localobject->id_prof_check(1, $localobject); // Must be > 0 |
|
| 309 | + $localobject->country_code = 'AR'; |
|
| 310 | + $localobject->idprof1 = 'id1ko'; |
|
| 311 | + $localobject->idprof2 = 'id2ko'; |
|
| 312 | + $result = $localobject->id_prof_check(1, $localobject); // Must be > 0 |
|
| 313 | 313 | print __METHOD__." OK AR idprof1 result=".$result."\n"; |
| 314 | 314 | $this->assertGreaterThanOrEqual(0, $result); |
| 315 | - $result=$localobject->id_prof_check(2, $localobject); // Must be > 0 |
|
| 315 | + $result = $localobject->id_prof_check(2, $localobject); // Must be > 0 |
|
| 316 | 316 | print __METHOD__." OK AR idprof2 result=".$result."\n"; |
| 317 | 317 | $this->assertGreaterThanOrEqual(1, $result); |
| 318 | 318 | |
@@ -331,37 +331,37 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | public function testSocieteOther($localobject) |
| 333 | 333 | { |
| 334 | - global $conf,$user,$langs,$db; |
|
| 335 | - $conf=$this->savconf; |
|
| 336 | - $user=$this->savuser; |
|
| 337 | - $langs=$this->savlangs; |
|
| 338 | - $db=$this->savdb; |
|
| 334 | + global $conf, $user, $langs, $db; |
|
| 335 | + $conf = $this->savconf; |
|
| 336 | + $user = $this->savuser; |
|
| 337 | + $langs = $this->savlangs; |
|
| 338 | + $db = $this->savdb; |
|
| 339 | 339 | |
| 340 | - $result=$localobject->setAsCustomer(); |
|
| 340 | + $result = $localobject->setAsCustomer(); |
|
| 341 | 341 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 342 | 342 | $this->assertLessThan($result, 0); |
| 343 | 343 | |
| 344 | - $result=$localobject->setPriceLevel(1, $user); |
|
| 344 | + $result = $localobject->setPriceLevel(1, $user); |
|
| 345 | 345 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 346 | 346 | $this->assertLessThan($result, 0); |
| 347 | 347 | |
| 348 | - $result=$localobject->set_remise_client(10, 'Gift', $user); |
|
| 348 | + $result = $localobject->set_remise_client(10, 'Gift', $user); |
|
| 349 | 349 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 350 | 350 | $this->assertLessThan($result, 0); |
| 351 | 351 | |
| 352 | - $result=$localobject->getNomUrl(1); |
|
| 352 | + $result = $localobject->getNomUrl(1); |
|
| 353 | 353 | print __METHOD__." id=".$localobject->id." result=".$result."\n"; |
| 354 | 354 | $this->assertNotEquals($result, ''); |
| 355 | 355 | |
| 356 | 356 | $localobject->country_code = 'FR'; |
| 357 | 357 | |
| 358 | - $result=$localobject->isInEEC(); |
|
| 358 | + $result = $localobject->isInEEC(); |
|
| 359 | 359 | print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n"; |
| 360 | 360 | $this->assertTrue($result); |
| 361 | 361 | |
| 362 | 362 | $localobject->country_code = 'US'; |
| 363 | 363 | |
| 364 | - $result=$localobject->isInEEC(); |
|
| 364 | + $result = $localobject->isInEEC(); |
|
| 365 | 365 | print __METHOD__." id=".$localobject->id." country_code=".$localobject->country_code." result=".$result."\n"; |
| 366 | 366 | $this->assertFalse($result); |
| 367 | 367 | |
@@ -391,16 +391,16 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function testGetOutstandingBills($id) |
| 393 | 393 | { |
| 394 | - global $conf,$user,$langs,$db; |
|
| 395 | - $conf=$this->savconf; |
|
| 396 | - $user=$this->savuser; |
|
| 397 | - $langs=$this->savlangs; |
|
| 398 | - $db=$this->savdb; |
|
| 394 | + global $conf, $user, $langs, $db; |
|
| 395 | + $conf = $this->savconf; |
|
| 396 | + $user = $this->savuser; |
|
| 397 | + $langs = $this->savlangs; |
|
| 398 | + $db = $this->savdb; |
|
| 399 | 399 | |
| 400 | - $localobject=new Societe($db); |
|
| 400 | + $localobject = new Societe($db); |
|
| 401 | 401 | $localobject->fetch($id); |
| 402 | 402 | |
| 403 | - $result=$localobject->getOutstandingBills(); |
|
| 403 | + $result = $localobject->getOutstandingBills(); |
|
| 404 | 404 | |
| 405 | 405 | print __METHOD__." id=".$id." result=".var_export($result, true)."\n"; |
| 406 | 406 | $this->assertTrue(array_key_exists('opened', $result), 'Result of getOutstandingBills failed'); |
@@ -420,16 +420,16 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | public function testSocieteDelete($id) |
| 422 | 422 | { |
| 423 | - global $conf,$user,$langs,$db; |
|
| 424 | - $conf=$this->savconf; |
|
| 425 | - $user=$this->savuser; |
|
| 426 | - $langs=$this->savlangs; |
|
| 427 | - $db=$this->savdb; |
|
| 423 | + global $conf, $user, $langs, $db; |
|
| 424 | + $conf = $this->savconf; |
|
| 425 | + $user = $this->savuser; |
|
| 426 | + $langs = $this->savlangs; |
|
| 427 | + $db = $this->savdb; |
|
| 428 | 428 | |
| 429 | - $localobject=new Societe($db); |
|
| 430 | - $result=$localobject->fetch($id); |
|
| 429 | + $localobject = new Societe($db); |
|
| 430 | + $result = $localobject->fetch($id); |
|
| 431 | 431 | |
| 432 | - $result=$localobject->delete($id, $user); |
|
| 432 | + $result = $localobject->delete($id, $user); |
|
| 433 | 433 | print __METHOD__." id=".$id." result=".$result."\n"; |
| 434 | 434 | $this->assertLessThan($result, 0); |
| 435 | 435 | |
@@ -444,57 +444,57 @@ discard block |
||
| 444 | 444 | */ |
| 445 | 445 | public function testSocieteGetFullAddress() |
| 446 | 446 | { |
| 447 | - global $conf,$user,$langs,$db; |
|
| 448 | - $conf=$this->savconf; |
|
| 449 | - $user=$this->savuser; |
|
| 450 | - $langs=$this->savlangs; |
|
| 451 | - $db=$this->savdb; |
|
| 447 | + global $conf, $user, $langs, $db; |
|
| 448 | + $conf = $this->savconf; |
|
| 449 | + $user = $this->savuser; |
|
| 450 | + $langs = $this->savlangs; |
|
| 451 | + $db = $this->savdb; |
|
| 452 | 452 | |
| 453 | - $localobjectadd=new Societe($db); |
|
| 453 | + $localobjectadd = new Societe($db); |
|
| 454 | 454 | $localobjectadd->initAsSpecimen(); |
| 455 | 455 | |
| 456 | 456 | // France |
| 457 | 457 | unset($localobjectadd->country_code); |
| 458 | - $localobjectadd->country_id=1; |
|
| 459 | - $localobjectadd->name='New name'; |
|
| 460 | - $localobjectadd->address='New address'; |
|
| 461 | - $localobjectadd->zip='New zip'; |
|
| 462 | - $localobjectadd->town='New town'; |
|
| 463 | - $result=$localobjectadd->getFullAddress(1); |
|
| 458 | + $localobjectadd->country_id = 1; |
|
| 459 | + $localobjectadd->name = 'New name'; |
|
| 460 | + $localobjectadd->address = 'New address'; |
|
| 461 | + $localobjectadd->zip = 'New zip'; |
|
| 462 | + $localobjectadd->town = 'New town'; |
|
| 463 | + $result = $localobjectadd->getFullAddress(1); |
|
| 464 | 464 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
| 465 | 465 | $this->assertStringContainsString("New address\nNew zip New town\nFrance", $result); |
| 466 | 466 | |
| 467 | 467 | // Belgium |
| 468 | 468 | unset($localobjectadd->country_code); |
| 469 | - $localobjectadd->country_id=2; |
|
| 470 | - $localobjectadd->name='New name'; |
|
| 471 | - $localobjectadd->address='New address'; |
|
| 472 | - $localobjectadd->zip='New zip'; |
|
| 473 | - $localobjectadd->town='New town'; |
|
| 474 | - $result=$localobjectadd->getFullAddress(1); |
|
| 469 | + $localobjectadd->country_id = 2; |
|
| 470 | + $localobjectadd->name = 'New name'; |
|
| 471 | + $localobjectadd->address = 'New address'; |
|
| 472 | + $localobjectadd->zip = 'New zip'; |
|
| 473 | + $localobjectadd->town = 'New town'; |
|
| 474 | + $result = $localobjectadd->getFullAddress(1); |
|
| 475 | 475 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
| 476 | 476 | $this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result); |
| 477 | 477 | |
| 478 | 478 | // Switzerland |
| 479 | 479 | unset($localobjectadd->country_code); |
| 480 | - $localobjectadd->country_id=6; |
|
| 481 | - $localobjectadd->name='New name'; |
|
| 482 | - $localobjectadd->address='New address'; |
|
| 483 | - $localobjectadd->zip='New zip'; |
|
| 484 | - $localobjectadd->town='New town'; |
|
| 485 | - $result=$localobjectadd->getFullAddress(1); |
|
| 480 | + $localobjectadd->country_id = 6; |
|
| 481 | + $localobjectadd->name = 'New name'; |
|
| 482 | + $localobjectadd->address = 'New address'; |
|
| 483 | + $localobjectadd->zip = 'New zip'; |
|
| 484 | + $localobjectadd->town = 'New town'; |
|
| 485 | + $result = $localobjectadd->getFullAddress(1); |
|
| 486 | 486 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
| 487 | 487 | $this->assertStringContainsString("New address\nNew zip New town\nSwitzerland", $result); |
| 488 | 488 | |
| 489 | 489 | // USA |
| 490 | 490 | unset($localobjectadd->country_code); |
| 491 | - $localobjectadd->country_id=11; |
|
| 492 | - $localobjectadd->name='New name'; |
|
| 493 | - $localobjectadd->address='New address'; |
|
| 494 | - $localobjectadd->zip='New zip'; |
|
| 495 | - $localobjectadd->town='New town'; |
|
| 496 | - $localobjectadd->state='New state'; |
|
| 497 | - $result=$localobjectadd->getFullAddress(1); |
|
| 491 | + $localobjectadd->country_id = 11; |
|
| 492 | + $localobjectadd->name = 'New name'; |
|
| 493 | + $localobjectadd->address = 'New address'; |
|
| 494 | + $localobjectadd->zip = 'New zip'; |
|
| 495 | + $localobjectadd->town = 'New town'; |
|
| 496 | + $localobjectadd->state = 'New state'; |
|
| 497 | + $result = $localobjectadd->getFullAddress(1); |
|
| 498 | 498 | print __METHOD__." id=".$localobjectadd->id." result=".$result."\n"; |
| 499 | 499 | $this->assertStringContainsString("New address\nNew town, New state, New zip\nUnited States", $result); |
| 500 | 500 | |