@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | $label = $langs->trans("ShowProject"); |
| 1392 | 1392 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
| 1393 | 1393 | } |
| 1394 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 1394 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 1395 | 1395 | $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; |
| 1396 | 1396 | } else { |
| 1397 | 1397 | $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
@@ -1758,7 +1758,7 @@ discard block |
||
| 1758 | 1758 | |
| 1759 | 1759 | foreach (array('internal', 'external') as $source) { |
| 1760 | 1760 | $tab = $origin_project->liste_contact(-1, $source); |
| 1761 | - if (is_array($tab) && count($tab)>0) { |
|
| 1761 | + if (is_array($tab) && count($tab) > 0) { |
|
| 1762 | 1762 | foreach ($tab as $contacttoadd) { |
| 1763 | 1763 | $clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger); |
| 1764 | 1764 | if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
@@ -1943,7 +1943,7 @@ discard block |
||
| 1943 | 1943 | if ($tableName == "actioncomm") { |
| 1944 | 1944 | $sql .= " SET fk_project=".$this->id; |
| 1945 | 1945 | $sql .= " WHERE id=".((int) $elementSelectId); |
| 1946 | - } elseif (in_array($tableName, ["entrepot","mrp_mo","stocktransfer_stocktransfer"])) { |
|
| 1946 | + } elseif (in_array($tableName, ["entrepot", "mrp_mo", "stocktransfer_stocktransfer"])) { |
|
| 1947 | 1947 | $sql .= " SET fk_project=".$this->id; |
| 1948 | 1948 | $sql .= " WHERE rowid=".((int) $elementSelectId); |
| 1949 | 1949 | } else { |
@@ -2380,7 +2380,7 @@ discard block |
||
| 2380 | 2380 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
| 2381 | 2381 | $taskstatic = new Task($this->db); |
| 2382 | 2382 | |
| 2383 | - $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); |
|
| 2383 | + $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); |
|
| 2384 | 2384 | return 1; |
| 2385 | 2385 | } |
| 2386 | 2386 | |
@@ -2451,7 +2451,7 @@ discard block |
||
| 2451 | 2451 | $return .= '<br><div class="info-box-ref tdoverflowmax150 inline-block valignmiddle">'.$this->thirdparty->getNomUrl(1); |
| 2452 | 2452 | $return .= '</div><div class="inline-block valignmiddle">'; |
| 2453 | 2453 | $return .= dol_print_phone($this->thirdparty->phone, $this->thirdparty->country_code, 0, $this->thirdparty->id, 'tel', 'hidenum', 'phone'); |
| 2454 | - $return .='</div>'; |
|
| 2454 | + $return .= '</div>'; |
|
| 2455 | 2455 | } |
| 2456 | 2456 | if (!empty($arraydata['assignedusers'])) { |
| 2457 | 2457 | $return .= '<br>'; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public $price; |
| 141 | 141 | |
| 142 | - public $price_formated; // used by takepos/ajax/ajax.php |
|
| 142 | + public $price_formated; // used by takepos/ajax/ajax.php |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Selling price with tax |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public $price_ttc; |
| 150 | 150 | |
| 151 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
| 151 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Minimum price net |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | public $packaging; |
| 228 | 228 | |
| 229 | 229 | |
| 230 | - public $lifetime; // In seconds |
|
| 230 | + public $lifetime; // In seconds |
|
| 231 | 231 | |
| 232 | 232 | public $qc_frequency; |
| 233 | 233 | |
@@ -359,20 +359,20 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | //! Metric of products |
| 361 | 361 | public $weight; |
| 362 | - public $weight_units; // scale -3, 0, 3, 6 |
|
| 362 | + public $weight_units; // scale -3, 0, 3, 6 |
|
| 363 | 363 | public $length; |
| 364 | - public $length_units; // scale -3, 0, 3, 6 |
|
| 364 | + public $length_units; // scale -3, 0, 3, 6 |
|
| 365 | 365 | public $width; |
| 366 | - public $width_units; // scale -3, 0, 3, 6 |
|
| 366 | + public $width_units; // scale -3, 0, 3, 6 |
|
| 367 | 367 | public $height; |
| 368 | - public $height_units; // scale -3, 0, 3, 6 |
|
| 368 | + public $height_units; // scale -3, 0, 3, 6 |
|
| 369 | 369 | public $surface; |
| 370 | - public $surface_units; // scale -3, 0, 3, 6 |
|
| 370 | + public $surface_units; // scale -3, 0, 3, 6 |
|
| 371 | 371 | public $volume; |
| 372 | - public $volume_units; // scale -3, 0, 3, 6 |
|
| 372 | + public $volume_units; // scale -3, 0, 3, 6 |
|
| 373 | 373 | |
| 374 | 374 | public $net_measure; |
| 375 | - public $net_measure_units; // scale -3, 0, 3, 6 |
|
| 375 | + public $net_measure_units; // scale -3, 0, 3, 6 |
|
| 376 | 376 | |
| 377 | 377 | public $accountancy_code_sell; |
| 378 | 378 | public $accountancy_code_sell_intra; |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), |
| 560 | 560 | //'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')), |
| 561 | 561 | //'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')), |
| 562 | - 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatoryperiod', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
| 562 | + 'mandatory_period' => array('type'=>'integer', 'label'=>'mandatoryperiod', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000), |
|
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -849,9 +849,9 @@ discard block |
||
| 849 | 849 | |
| 850 | 850 | // update accountancy for this entity |
| 851 | 851 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 852 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
| 852 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
| 853 | 853 | |
| 854 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
| 854 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
| 855 | 855 | $sql .= " fk_product"; |
| 856 | 856 | $sql .= ", entity"; |
| 857 | 857 | $sql .= ", accountancy_code_buy"; |
@@ -862,13 +862,13 @@ discard block |
||
| 862 | 862 | $sql .= ", accountancy_code_sell_export"; |
| 863 | 863 | $sql .= ") VALUES ("; |
| 864 | 864 | $sql .= $this->id; |
| 865 | - $sql .= ", " . $conf->entity; |
|
| 866 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 867 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 868 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 869 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 870 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 871 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 865 | + $sql .= ", ".$conf->entity; |
|
| 866 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 867 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 868 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 869 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 870 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 871 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 872 | 872 | $sql .= ")"; |
| 873 | 873 | $result = $this->db->query($sql); |
| 874 | 874 | if (!$result) { |
@@ -1233,12 +1233,12 @@ discard block |
||
| 1233 | 1233 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); |
| 1234 | 1234 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; |
| 1235 | 1235 | if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 1236 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1237 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 1238 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 1239 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1240 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 1241 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 1236 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1237 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 1238 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 1239 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1240 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 1241 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 1242 | 1242 | } |
| 1243 | 1243 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); |
| 1244 | 1244 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); |
| 1247 | 1247 | $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); |
| 1248 | 1248 | $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); |
| 1249 | - $sql .= ", mandatory_period = ".($this->mandatory_period ); |
|
| 1249 | + $sql .= ", mandatory_period = ".($this->mandatory_period); |
|
| 1250 | 1250 | // stock field is not here because it is a denormalized value from product_stock. |
| 1251 | 1251 | $sql .= " WHERE rowid = ".((int) $id); |
| 1252 | 1252 | |
@@ -1268,9 +1268,9 @@ discard block |
||
| 1268 | 1268 | |
| 1269 | 1269 | // update accountancy for this entity |
| 1270 | 1270 | if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 1271 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
| 1271 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
| 1272 | 1272 | |
| 1273 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
| 1273 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
| 1274 | 1274 | $sql .= " fk_product"; |
| 1275 | 1275 | $sql .= ", entity"; |
| 1276 | 1276 | $sql .= ", accountancy_code_buy"; |
@@ -1281,13 +1281,13 @@ discard block |
||
| 1281 | 1281 | $sql .= ", accountancy_code_sell_export"; |
| 1282 | 1282 | $sql .= ") VALUES ("; |
| 1283 | 1283 | $sql .= $this->id; |
| 1284 | - $sql .= ", " . $conf->entity; |
|
| 1285 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
| 1286 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
| 1287 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
| 1288 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
| 1289 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
| 1290 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
| 1284 | + $sql .= ", ".$conf->entity; |
|
| 1285 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
| 1286 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
| 1287 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
| 1288 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
| 1289 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
| 1290 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
| 1291 | 1291 | $sql .= ")"; |
| 1292 | 1292 | $result = $this->db->query($sql); |
| 1293 | 1293 | if (!$result) { |
@@ -1299,8 +1299,8 @@ discard block |
||
| 1299 | 1299 | if (!$this->hasbatch() && $this->oldcopy->hasbatch()) { |
| 1300 | 1300 | // Selection of all product stock mouvements that contains batchs |
| 1301 | 1301 | $sql = 'SELECT pb.qty, pb.fk_entrepot, pb.batch FROM '.MAIN_DB_PREFIX.'product_batch as pb'; |
| 1302 | - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON (ps.rowid = batch.fk_product_stock)'; |
|
| 1303 | - $sql.= ' WHERE ps.fk_product = '.(int) $this->id; |
|
| 1302 | + $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON (ps.rowid = batch.fk_product_stock)'; |
|
| 1303 | + $sql .= ' WHERE ps.fk_product = '.(int) $this->id; |
|
| 1304 | 1304 | |
| 1305 | 1305 | $resql = $this->db->query($sql); |
| 1306 | 1306 | if ($resql) { |
@@ -1621,7 +1621,7 @@ discard block |
||
| 1621 | 1621 | } |
| 1622 | 1622 | } elseif (isset($this->multilangs[$key])) { |
| 1623 | 1623 | if (empty($this->multilangs["$key"]["label"])) { |
| 1624 | - $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
| 1624 | + $this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
| 1625 | 1625 | return -1; |
| 1626 | 1626 | } |
| 1627 | 1627 | |
@@ -1817,7 +1817,7 @@ discard block |
||
| 1817 | 1817 | private function getArrayForPriceCompare($level = 0) |
| 1818 | 1818 | { |
| 1819 | 1819 | |
| 1820 | - $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); |
|
| 1820 | + $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); |
|
| 1821 | 1821 | |
| 1822 | 1822 | foreach ($testExit as $field) { |
| 1823 | 1823 | if (!isset($this->$field)) { |
@@ -2440,20 +2440,20 @@ discard block |
||
| 2440 | 2440 | |
| 2441 | 2441 | //For MultiCompany |
| 2442 | 2442 | //PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity |
| 2443 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
| 2444 | - $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. |
|
| 2443 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
| 2444 | + $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. |
|
| 2445 | 2445 | $visibleWarehousesEntities = $conf->entity; |
| 2446 | 2446 | if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { |
| 2447 | 2447 | if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { |
| 2448 | - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
| 2449 | - if ($this->db->num_rows($checkPMPPerEntity)>0) { |
|
| 2448 | + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
| 2449 | + if ($this->db->num_rows($checkPMPPerEntity) > 0) { |
|
| 2450 | 2450 | $separatedEntityPMP = true; |
| 2451 | 2451 | } |
| 2452 | 2452 | } |
| 2453 | 2453 | global $mc; |
| 2454 | 2454 | $separatedStock = true; |
| 2455 | 2455 | if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { |
| 2456 | - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); |
|
| 2456 | + $visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); |
|
| 2457 | 2457 | } |
| 2458 | 2458 | } |
| 2459 | 2459 | if ($separatedEntityPMP) { |
@@ -2470,10 +2470,10 @@ discard block |
||
| 2470 | 2470 | } |
| 2471 | 2471 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
| 2472 | 2472 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { |
| 2473 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 2473 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 2474 | 2474 | } |
| 2475 | 2475 | if ($separatedStock) { |
| 2476 | - $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)."))"; |
|
| 2476 | + $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)."))"; |
|
| 2477 | 2477 | } |
| 2478 | 2478 | |
| 2479 | 2479 | if ($id) { |
@@ -2627,15 +2627,15 @@ discard block |
||
| 2627 | 2627 | $sql .= " WHERE entity IN (".getEntity('productprice').")"; |
| 2628 | 2628 | $sql .= " AND price_level=".((int) $i); |
| 2629 | 2629 | $sql .= " AND fk_product = ".((int) $this->id); |
| 2630 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
| 2631 | - $sql .= " LIMIT 1"; // Only the first one |
|
| 2630 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
| 2631 | + $sql .= " LIMIT 1"; // Only the first one |
|
| 2632 | 2632 | $resql = $this->db->query($sql); |
| 2633 | 2633 | if ($resql) { |
| 2634 | 2634 | $result = $this->db->fetch_array($resql); |
| 2635 | 2635 | |
| 2636 | 2636 | $this->multiprices[$i] = $result ? $result["price"] : null; |
| 2637 | 2637 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; |
| 2638 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
| 2638 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
| 2639 | 2639 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; |
| 2640 | 2640 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; |
| 2641 | 2641 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on |
@@ -2855,7 +2855,7 @@ discard block |
||
| 2855 | 2855 | $obj = $this->db->fetch_object($result); |
| 2856 | 2856 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
| 2857 | 2857 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
| 2858 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
| 2858 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
| 2859 | 2859 | } else { |
| 2860 | 2860 | $this->error = $this->db->error(); |
| 2861 | 2861 | $error++; |
@@ -4332,7 +4332,7 @@ discard block |
||
| 4332 | 4332 | //Addition of a product with the highest rank +1 |
| 4333 | 4333 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; |
| 4334 | 4334 | $sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".price2num($incdec, 'MS').", ".((int) $rank).")"; |
| 4335 | - if (! $this->db->query($sql)) { |
|
| 4335 | + if (!$this->db->query($sql)) { |
|
| 4336 | 4336 | dol_print_error($this->db); |
| 4337 | 4337 | return -1; |
| 4338 | 4338 | } else { |
@@ -4443,17 +4443,17 @@ discard block |
||
| 4443 | 4443 | |
| 4444 | 4444 | // Updated ranks so that none are missing |
| 4445 | 4445 | $sqlrank = "SELECT rowid, rang FROM ".$this->db->prefix()."product_association"; |
| 4446 | - $sqlrank.= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
| 4447 | - $sqlrank.= " ORDER BY rang"; |
|
| 4446 | + $sqlrank .= " WHERE fk_product_pere = ".((int) $fk_parent); |
|
| 4447 | + $sqlrank .= " ORDER BY rang"; |
|
| 4448 | 4448 | $resqlrank = $this->db->query($sqlrank); |
| 4449 | 4449 | if ($resqlrank) { |
| 4450 | 4450 | $cpt = 0; |
| 4451 | 4451 | while ($objrank = $this->db->fetch_object($resqlrank)) { |
| 4452 | 4452 | $cpt++; |
| 4453 | 4453 | $sql = "UPDATE ".$this->db->prefix()."product_association"; |
| 4454 | - $sql.= " SET rang = ".((int) $cpt); |
|
| 4455 | - $sql.= " WHERE rowid = ".((int) $objrank->rowid); |
|
| 4456 | - if (! $this->db->query($sql)) { |
|
| 4454 | + $sql .= " SET rang = ".((int) $cpt); |
|
| 4455 | + $sql .= " WHERE rowid = ".((int) $objrank->rowid); |
|
| 4456 | + if (!$this->db->query($sql)) { |
|
| 4457 | 4457 | dol_print_error($this->db); |
| 4458 | 4458 | return -1; |
| 4459 | 4459 | } |
@@ -4886,7 +4886,7 @@ discard block |
||
| 4886 | 4886 | if (isset($this->sousprods) && is_array($this->sousprods)) { |
| 4887 | 4887 | foreach ($this->sousprods as $prod_name => $desc_product) { |
| 4888 | 4888 | if (is_array($desc_product)) { |
| 4889 | - $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
| 4889 | + $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
| 4890 | 4890 | } |
| 4891 | 4891 | } |
| 4892 | 4892 | } |
@@ -5041,9 +5041,9 @@ discard block |
||
| 5041 | 5041 | $sql .= " WHERE p.rowid = pa.fk_product_fils"; |
| 5042 | 5042 | $sql .= " AND pa.fk_product_pere = ".((int) $id); |
| 5043 | 5043 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens |
| 5044 | - $sql.= " ORDER BY pa.rang"; |
|
| 5044 | + $sql .= " ORDER BY pa.rang"; |
|
| 5045 | 5045 | |
| 5046 | - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); |
|
| 5046 | + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ?implode(',', $parents) : $parents), LOG_DEBUG); |
|
| 5047 | 5047 | |
| 5048 | 5048 | if ($level == 1) { |
| 5049 | 5049 | $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 |
@@ -5133,41 +5133,41 @@ discard block |
||
| 5133 | 5133 | if (!empty($this->entity)) { |
| 5134 | 5134 | $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1); |
| 5135 | 5135 | if ($this->nbphoto > 0) { |
| 5136 | - $datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>'; |
|
| 5136 | + $datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>'; |
|
| 5137 | 5137 | } |
| 5138 | 5138 | } |
| 5139 | 5139 | |
| 5140 | 5140 | if ($this->type == Product::TYPE_PRODUCT) { |
| 5141 | 5141 | $datas['picto'] = img_picto('', 'product').' <u class="paddingrightonly">'.$langs->trans("Product").'</u>'; |
| 5142 | 5142 | } elseif ($this->type == Product::TYPE_SERVICE) { |
| 5143 | - $datas['picto']= img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
| 5143 | + $datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
|
| 5144 | 5144 | } |
| 5145 | 5145 | if (isset($this->status) && isset($this->status_buy)) { |
| 5146 | - $datas['status']= ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); |
|
| 5146 | + $datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1); |
|
| 5147 | 5147 | } |
| 5148 | 5148 | |
| 5149 | 5149 | if (!empty($this->ref)) { |
| 5150 | - $datas['ref']= '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
| 5150 | + $datas['ref'] = '<br><b>'.$langs->trans('ProductRef').':</b> '.$this->ref; |
|
| 5151 | 5151 | } |
| 5152 | 5152 | if (!empty($this->label)) { |
| 5153 | - $datas['label']= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
| 5153 | + $datas['label'] = '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label; |
|
| 5154 | 5154 | } |
| 5155 | 5155 | if (!empty($this->description)) { |
| 5156 | - $datas['description']= '<br><b>'.$langs->trans('ProductDescription').':</b> '.dolGetFirstLineofText($this->description, 5); |
|
| 5156 | + $datas['description'] = '<br><b>'.$langs->trans('ProductDescription').':</b> '.dolGetFirstLineofText($this->description, 5); |
|
| 5157 | 5157 | } |
| 5158 | 5158 | if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
| 5159 | 5159 | if (isModEnabled('productbatch')) { |
| 5160 | 5160 | $langs->load("productbatch"); |
| 5161 | - $datas['batchstatus']= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
| 5161 | + $datas['batchstatus'] = "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2); |
|
| 5162 | 5162 | } |
| 5163 | 5163 | } |
| 5164 | 5164 | if (isModEnabled('barcode')) { |
| 5165 | - $datas['barcode']= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
| 5165 | + $datas['barcode'] = '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode; |
|
| 5166 | 5166 | } |
| 5167 | 5167 | |
| 5168 | 5168 | if ($this->type == Product::TYPE_PRODUCT) { |
| 5169 | 5169 | if ($this->weight) { |
| 5170 | - $datas['weight']= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
| 5170 | + $datas['weight'] = "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); |
|
| 5171 | 5171 | } |
| 5172 | 5172 | $labelsize = ""; |
| 5173 | 5173 | if ($this->length) { |
@@ -5180,7 +5180,7 @@ discard block |
||
| 5180 | 5180 | $labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); |
| 5181 | 5181 | } |
| 5182 | 5182 | if ($labelsize) { |
| 5183 | - $datas['size']= "<br>".$labelsize; |
|
| 5183 | + $datas['size'] = "<br>".$labelsize; |
|
| 5184 | 5184 | } |
| 5185 | 5185 | |
| 5186 | 5186 | $labelsurfacevolume = ""; |
@@ -5191,7 +5191,7 @@ discard block |
||
| 5191 | 5191 | $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); |
| 5192 | 5192 | } |
| 5193 | 5193 | if ($labelsurfacevolume) { |
| 5194 | - $datas['surface']= "<br>" . $labelsurfacevolume; |
|
| 5194 | + $datas['surface'] = "<br>".$labelsurfacevolume; |
|
| 5195 | 5195 | } |
| 5196 | 5196 | } |
| 5197 | 5197 | if (!empty($this->pmp) && $this->pmp) { |
@@ -5221,9 +5221,9 @@ discard block |
||
| 5221 | 5221 | } |
| 5222 | 5222 | // show categories for this record only in ajax to not overload lists |
| 5223 | 5223 | if (isModEnabled('categorie') && !$nofetch) { |
| 5224 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 5224 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 5225 | 5225 | $form = new Form($this->db); |
| 5226 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
| 5226 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
| 5227 | 5227 | } |
| 5228 | 5228 | |
| 5229 | 5229 | return $datas; |
@@ -5275,7 +5275,7 @@ discard block |
||
| 5275 | 5275 | $label = $langs->trans("ShowProduct"); |
| 5276 | 5276 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; |
| 5277 | 5277 | } |
| 5278 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"'); |
|
| 5278 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"'); |
|
| 5279 | 5279 | $linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; |
| 5280 | 5280 | } else { |
| 5281 | 5281 | $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; |
@@ -5452,7 +5452,7 @@ discard block |
||
| 5452 | 5452 | $labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial')); |
| 5453 | 5453 | $labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort')); |
| 5454 | 5454 | } |
| 5455 | - } elseif ( $type == 2 && $status == 2 ) { |
|
| 5455 | + } elseif ($type == 2 && $status == 2) { |
|
| 5456 | 5456 | $labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial'); |
| 5457 | 5457 | $labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'); |
| 5458 | 5458 | } |
@@ -5663,7 +5663,7 @@ discard block |
||
| 5663 | 5663 | $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; |
| 5664 | 5664 | } |
| 5665 | 5665 | |
| 5666 | - $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; |
|
| 5666 | + $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; |
|
| 5667 | 5667 | |
| 5668 | 5668 | dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); |
| 5669 | 5669 | $result = $this->db->query($sql); |
@@ -5744,7 +5744,7 @@ discard block |
||
| 5744 | 5744 | if (isModEnabled("supplier_order")) { |
| 5745 | 5745 | $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; |
| 5746 | 5746 | if (isset($includedraftpoforvirtual)) { |
| 5747 | - $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 |
|
| 5747 | + $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 |
|
| 5748 | 5748 | } |
| 5749 | 5749 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); |
| 5750 | 5750 | if ($result < 0) { |
@@ -6138,7 +6138,7 @@ discard block |
||
| 6138 | 6138 | if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { |
| 6139 | 6139 | $dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); |
| 6140 | 6140 | foreach ($dirsociete as $dirroot) { |
| 6141 | - $res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); |
|
| 6141 | + $res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); |
|
| 6142 | 6142 | if ($res) { |
| 6143 | 6143 | break; |
| 6144 | 6144 | } |
@@ -6437,7 +6437,7 @@ discard block |
||
| 6437 | 6437 | global $langs; |
| 6438 | 6438 | |
| 6439 | 6439 | if (empty($this->duration_value)) { |
| 6440 | - $this->errors[]='ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
| 6440 | + $this->errors[] = 'ErrorDurationForServiceNotDefinedCantCalculateHourlyPrice'; |
|
| 6441 | 6441 | return -1; |
| 6442 | 6442 | } |
| 6443 | 6443 | |
@@ -6474,7 +6474,7 @@ discard block |
||
| 6474 | 6474 | */ |
| 6475 | 6475 | public function getKanbanView($option = '', $arraydata = null) |
| 6476 | 6476 | { |
| 6477 | - global $langs,$conf; |
|
| 6477 | + global $langs, $conf; |
|
| 6478 | 6478 | |
| 6479 | 6479 | $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); |
| 6480 | 6480 | |
@@ -6515,7 +6515,7 @@ discard block |
||
| 6515 | 6515 | $return .= '<br><span class="info-box-status opacitymedium">'.$langs->trans('PhysicalStock').' : <span class="bold">'.$this->stock_reel.'</span></span>'; |
| 6516 | 6516 | } |
| 6517 | 6517 | if (method_exists($this, 'getLibStatut')) { |
| 6518 | - $return .='<br><span class="info-box-status margintoponly">'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).'</span>'; |
|
| 6518 | + $return .= '<br><span class="info-box-status margintoponly">'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).'</span>'; |
|
| 6519 | 6519 | } |
| 6520 | 6520 | $return .= '</div>'; |
| 6521 | 6521 | $return .= '</div>'; |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | /** |
| 389 | 389 | * Shipment on process |
| 390 | 390 | */ |
| 391 | - const STATUS_SHIPMENTONPROCESS = 2; // We set this status when a shipment is validated |
|
| 392 | - const STATUS_ACCEPTED = 2; // For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead. |
|
| 391 | + const STATUS_SHIPMENTONPROCESS = 2; // We set this status when a shipment is validated |
|
| 392 | + const STATUS_ACCEPTED = 2; // For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead. |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * Closed (Sent, billed or not) |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | if (!empty($conf->global->COMMANDE_ADDON)) { |
| 423 | 423 | $mybool = false; |
| 424 | 424 | |
| 425 | - $file = getDolGlobalString('COMMANDE_ADDON') . ".php"; |
|
| 425 | + $file = getDolGlobalString('COMMANDE_ADDON').".php"; |
|
| 426 | 426 | $classname = $conf->global->COMMANDE_ADDON; |
| 427 | 427 | |
| 428 | 428 | // Include file with class |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | // Set new ref and current status |
| 598 | 598 | if (!$error) { |
| 599 | 599 | $this->ref = $num; |
| 600 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 600 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 601 | 601 | $this->status = self::STATUS_VALIDATED; |
| 602 | 602 | } |
| 603 | 603 | |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | if ($objsoc->fetch($socid) > 0) { |
| 1219 | 1219 | $this->socid = $objsoc->id; |
| 1220 | 1220 | $this->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); |
| 1221 | - $this->deposit_percent = (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : null); |
|
| 1221 | + $this->deposit_percent = (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : null); |
|
| 1222 | 1222 | $this->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); |
| 1223 | 1223 | $this->fk_project = 0; |
| 1224 | 1224 | $this->fk_delivery_address = 0; |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | $line->fk_parent_line = $object->lines[$i]->fk_parent_line; |
| 1343 | 1343 | $line->fk_unit = $object->lines[$i]->fk_unit; |
| 1344 | 1344 | |
| 1345 | - $line->date_start = $object->lines[$i]->date_start; |
|
| 1345 | + $line->date_start = $object->lines[$i]->date_start; |
|
| 1346 | 1346 | $line->date_end = $object->lines[$i]->date_end; |
| 1347 | 1347 | |
| 1348 | 1348 | $line->fk_fournprice = $object->lines[$i]->fk_fournprice; |
@@ -3570,15 +3570,15 @@ discard block |
||
| 3570 | 3570 | //$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0"; |
| 3571 | 3571 | if ($mode == 'toship') { |
| 3572 | 3572 | // An order to ship is an open order (validated or in progress) |
| 3573 | - $sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ")"; |
|
| 3573 | + $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")"; |
|
| 3574 | 3574 | } |
| 3575 | 3575 | if ($mode == 'tobill') { |
| 3576 | 3576 | // An order to bill is an order not already billed |
| 3577 | - $sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ", " . self::STATUS_CLOSED . ") AND c.facture = 0"; |
|
| 3577 | + $sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.", ".self::STATUS_CLOSED.") AND c.facture = 0"; |
|
| 3578 | 3578 | } |
| 3579 | 3579 | if ($mode == 'shippedtobill') { |
| 3580 | 3580 | // An order shipped and to bill is a delivered order not already billed |
| 3581 | - $sql .= " AND c.fk_statut IN (" . self::STATUS_CLOSED . ") AND c.facture = 0"; |
|
| 3581 | + $sql .= " AND c.fk_statut IN (".self::STATUS_CLOSED.") AND c.facture = 0"; |
|
| 3582 | 3582 | } |
| 3583 | 3583 | if ($user->socid) { |
| 3584 | 3584 | $sql .= " AND c.fk_soc = ".((int) $user->socid); |
@@ -3862,7 +3862,7 @@ discard block |
||
| 3862 | 3862 | $label = $langs->trans("Order"); |
| 3863 | 3863 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
| 3864 | 3864 | } |
| 3865 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 3865 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 3866 | 3866 | $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; |
| 3867 | 3867 | |
| 3868 | 3868 | $target_value = array('_self', '_blank', '_parent', '_top'); |
@@ -3904,7 +3904,7 @@ discard block |
||
| 3904 | 3904 | } |
| 3905 | 3905 | |
| 3906 | 3906 | global $action; |
| 3907 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 3907 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 3908 | 3908 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
| 3909 | 3909 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 3910 | 3910 | if ($reshook > 0) { |
@@ -4305,7 +4305,7 @@ discard block |
||
| 4305 | 4305 | $objp = $this->db->fetch_object($result); |
| 4306 | 4306 | |
| 4307 | 4307 | if (!$objp) { |
| 4308 | - $this->error = 'OrderLine with id '. $rowid .' not found sql='.$sql; |
|
| 4308 | + $this->error = 'OrderLine with id '.$rowid.' not found sql='.$sql; |
|
| 4309 | 4309 | return 0; |
| 4310 | 4310 | } |
| 4311 | 4311 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $this->db = $db; |
| 44 | 44 | |
| 45 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 46 | - $this->family = "core"; |
|
| 47 | - $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; |
|
| 48 | - $this->version = self::VERSION_DOLIBARR; // VERSION_ 'DEVELOPMENT' or 'EXPERMENTAL' or 'DOLIBARR' |
|
| 49 | - $this->picto = 'technic'; |
|
| 45 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
| 46 | + $this->family = "core"; |
|
| 47 | + $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; |
|
| 48 | + $this->version = self::VERSION_DOLIBARR; // VERSION_ 'DEVELOPMENT' or 'EXPERMENTAL' or 'DOLIBARR' |
|
| 49 | + $this->picto = 'technic'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -87,40 +87,40 @@ discard block |
||
| 87 | 87 | // Actions |
| 88 | 88 | switch ($action) { |
| 89 | 89 | case 'USER_LOGIN': |
| 90 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 90 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 91 | 91 | // Initialize data (date,duree,text,desc) |
| 92 | - $text = "(UserLogged," . $object->login . ")"; |
|
| 93 | - $desc = "(UserLogged," . $object->login . ")"; |
|
| 92 | + $text = "(UserLogged,".$object->login.")"; |
|
| 93 | + $desc = "(UserLogged,".$object->login.")"; |
|
| 94 | 94 | break; |
| 95 | 95 | case 'USER_LOGIN_FAILED': |
| 96 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 96 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 97 | 97 | break; |
| 98 | 98 | case 'USER_LOGOUT': |
| 99 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 99 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 100 | 100 | // Initialize data (date,duree,text,desc) |
| 101 | - $text = "(UserLogoff," . $object->login . ")"; |
|
| 102 | - $desc = "(UserLogoff," . $object->login . ")"; |
|
| 101 | + $text = "(UserLogoff,".$object->login.")"; |
|
| 102 | + $desc = "(UserLogoff,".$object->login.")"; |
|
| 103 | 103 | break; |
| 104 | 104 | case 'USER_CREATE': |
| 105 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 105 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 106 | 106 | // Initialize data (date,duree,text,desc) |
| 107 | 107 | $text = $langs->transnoentities("NewUserCreated", $object->login); |
| 108 | 108 | $desc = $langs->transnoentities("NewUserCreated", $object->login); |
| 109 | 109 | break; |
| 110 | 110 | case 'USER_MODIFY': |
| 111 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 111 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 112 | 112 | // Initialize data (date,duree,text,desc) |
| 113 | 113 | $text = $langs->transnoentities("EventUserModified", $object->login); |
| 114 | 114 | $desc = $langs->transnoentities("EventUserModified", $object->login); |
| 115 | 115 | break; |
| 116 | 116 | case 'USER_NEW_PASSWORD': |
| 117 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 117 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 118 | 118 | // Initialize data (date,duree,text,desc) |
| 119 | 119 | $text = $langs->transnoentities("NewUserPassword", $object->login); |
| 120 | 120 | $desc = $langs->transnoentities("NewUserPassword", $object->login); |
| 121 | 121 | break; |
| 122 | 122 | case 'USER_ENABLEDISABLE': |
| 123 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 123 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 124 | 124 | // Initialize data (date,duree,text,desc) |
| 125 | 125 | if ($object->statut == 0) { |
| 126 | 126 | $text = $langs->transnoentities("UserEnabled", $object->login); |
@@ -132,31 +132,31 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | break; |
| 134 | 134 | case 'USER_DELETE': |
| 135 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 135 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 136 | 136 | // Initialize data (date,duree,text,desc) |
| 137 | 137 | $text = $langs->transnoentities("UserDeleted", $object->login); |
| 138 | 138 | $desc = $langs->transnoentities("UserDeleted", $object->login); |
| 139 | 139 | break; |
| 140 | 140 | case 'USERGROUP_CREATE': |
| 141 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 141 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 142 | 142 | // Initialize data (date,duree,text,desc) |
| 143 | 143 | $text = $langs->transnoentities("NewGroupCreated", $object->name); |
| 144 | 144 | $desc = $langs->transnoentities("NewGroupCreated", $object->name); |
| 145 | 145 | break; |
| 146 | 146 | case 'USERGROUP_MODIFY': |
| 147 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 147 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 148 | 148 | // Initialize data (date,duree,text,desc) |
| 149 | 149 | $text = $langs->transnoentities("GroupModified", $object->name); |
| 150 | 150 | $desc = $langs->transnoentities("GroupModified", $object->name); |
| 151 | 151 | break; |
| 152 | 152 | case 'USERGROUP_DELETE': |
| 153 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 153 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 154 | 154 | // Initialize data (date,duree,text,desc) |
| 155 | 155 | $text = $langs->transnoentities("GroupDeleted", $object->name); |
| 156 | 156 | $desc = $langs->transnoentities("GroupDeleted", $object->name); |
| 157 | 157 | break; |
| 158 | 158 | default: |
| 159 | - dol_syslog("Unknown action. Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
| 159 | + dol_syslog("Unknown action. Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
| 160 | 160 | break; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | define("DOLENTITY", $entity); |
| 52 | 52 | } |
| 53 | 53 | include '../../main.inc.php'; |
| 54 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 54 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 55 | 55 | |
| 56 | 56 | $action = GETPOST('action', 'aZ09'); |
| 57 | 57 | |
| 58 | 58 | $signature = GETPOST('signaturebase64'); |
| 59 | 59 | $ref = GETPOST('ref', 'aZ09'); |
| 60 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 60 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 61 | 61 | $SECUREKEY = GETPOST("securekey"); // Secure key |
| 62 | 62 | $online_sign_name = GETPOST("onlinesignname") ? GETPOST("onlinesignname") : ''; |
| 63 | 63 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 76 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
| 75 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 76 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -97,29 +97,29 @@ discard block |
||
| 97 | 97 | $data = base64_decode($signature); |
| 98 | 98 | |
| 99 | 99 | if ($mode == "propale" || $mode == 'proposal') { |
| 100 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 101 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 100 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 101 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 102 | 102 | $object = new Propal($db); |
| 103 | 103 | $object->fetch(0, $ref); |
| 104 | 104 | |
| 105 | 105 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; |
| 106 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 106 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 107 | 107 | |
| 108 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 109 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 108 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 109 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 110 | 110 | $langs->loadLangs(array("main", "companies")); |
| 111 | 111 | |
| 112 | 112 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 113 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 114 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 115 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 116 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 113 | + $filename = "signatures/".$date."_signature.png"; |
|
| 114 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 115 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 116 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 117 | 117 | $error++; |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if (!$error) { |
| 122 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 122 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 123 | 123 | if ($return == false) { |
| 124 | 124 | $error++; |
| 125 | 125 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | if (!$error) { |
| 130 | 130 | // Defined modele of doc |
| 131 | 131 | $last_main_doc_file = $object->last_main_doc; |
| 132 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 132 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 133 | 133 | |
| 134 | 134 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 135 | 135 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 136 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 137 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 136 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 137 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 138 | 138 | |
| 139 | 139 | if (dol_is_file($sourcefile)) { |
| 140 | 140 | // We build the new PDF |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | //$pdf->Open(); |
| 153 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 153 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 154 | 154 | |
| 155 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 155 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 156 | 156 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 157 | 157 | try { |
| 158 | 158 | $tppl = $pdf->importPage($i); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 161 | 161 | $pdf->useTemplate($tppl); |
| 162 | 162 | } catch (Exception $e) { |
| 163 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 163 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 164 | 164 | $response = $e->getMessage(); |
| 165 | 165 | $error++; |
| 166 | 166 | } |
@@ -174,11 +174,11 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
| 176 | 176 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
| 177 | - $pdf->MultiCell($wforimg, 4, $langs->trans("DateSigning") . ': ' . dol_print_date(dol_now(), "daytext", false, $langs, true), 0, 'L'); |
|
| 177 | + $pdf->MultiCell($wforimg, 4, $langs->trans("DateSigning").': '.dol_print_date(dol_now(), "daytext", false, $langs, true), 0, 'L'); |
|
| 178 | 178 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 179 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
|
| 179 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname").': '.$online_sign_name, 0, 'L'); |
|
| 180 | 180 | |
| 181 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 181 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 182 | 182 | |
| 183 | 183 | //$pdf->Close(); |
| 184 | 184 | $pdf->Output($newpdffilename, "F"); |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $online_sign_ip = getUserRemoteIP(); |
| 202 | 202 | |
| 203 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
| 204 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
| 205 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 206 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 203 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
| 204 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
| 205 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 206 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 207 | 207 | if ($online_sign_name) { |
| 208 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 208 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 209 | 209 | } |
| 210 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 210 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 211 | 211 | |
| 212 | 212 | dol_syslog(__FILE__, LOG_DEBUG); |
| 213 | 213 | $resql = $db->query($sql); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
| 227 | 227 | if ($result < 0) { |
| 228 | 228 | $error++; |
| 229 | - $response = "error in trigger " . $object->error; |
|
| 229 | + $response = "error in trigger ".$object->error; |
|
| 230 | 230 | } else { |
| 231 | 231 | $response = "success"; |
| 232 | 232 | } |
@@ -247,25 +247,25 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | } elseif ($mode == 'contract') { |
| 250 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 251 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 250 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 251 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 252 | 252 | $object = new Contrat($db); |
| 253 | 253 | $object->fetch(0, $ref); |
| 254 | 254 | |
| 255 | 255 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; |
| 256 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 256 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 257 | 257 | |
| 258 | 258 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 259 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 260 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 261 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 262 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 259 | + $filename = "signatures/".$date."_signature.png"; |
|
| 260 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 261 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 262 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 263 | 263 | $error++; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | if (!$error) { |
| 268 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 268 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 269 | 269 | if ($return == false) { |
| 270 | 270 | $error++; |
| 271 | 271 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -275,11 +275,11 @@ discard block |
||
| 275 | 275 | if (!$error) { |
| 276 | 276 | // Defined modele of doc |
| 277 | 277 | $last_main_doc_file = $object->last_main_doc; |
| 278 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 278 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 279 | 279 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 280 | 280 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 281 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 282 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 281 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 282 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 283 | 283 | |
| 284 | 284 | if (dol_is_file($sourcefile)) { |
| 285 | 285 | // We build the new PDF |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | |
| 298 | 298 | //$pdf->Open(); |
| 299 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 300 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 299 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 300 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 301 | 301 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 302 | 302 | try { |
| 303 | 303 | $tppl = $pdf->importPage($i); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 306 | 306 | $pdf->useTemplate($tppl); |
| 307 | 307 | } catch (Exception $e) { |
| 308 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 308 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 309 | 309 | $response = $e->getMessage(); |
| 310 | 310 | $error++; |
| 311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $yforimgstart = (empty($s['h']) ? 240 : $s['h'] - 65); |
| 318 | 318 | $wforimg = $s['w'] / 2 - $xforimgstart; |
| 319 | 319 | |
| 320 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 320 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 321 | 321 | //$pdf->Close(); |
| 322 | 322 | $pdf->Output($newpdffilename, "F"); |
| 323 | 323 | |
@@ -336,24 +336,24 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } elseif ($mode == 'fichinter') { |
| 339 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 340 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 339 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 340 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 341 | 341 | $object = new Fichinter($db); |
| 342 | 342 | $object->fetch(0, $ref); |
| 343 | 343 | |
| 344 | 344 | $upload_dir = !empty($conf->ficheinter->multidir_output[$object->entity]) ? $conf->ficheinter->multidir_output[$object->entity] : $conf->ficheinter->dir_output; |
| 345 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 345 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 346 | 346 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 347 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 348 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 349 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 350 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 347 | + $filename = "signatures/".$date."_signature.png"; |
|
| 348 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 349 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 350 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 351 | 351 | $error++; |
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | if (!$error) { |
| 356 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 356 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 357 | 357 | if ($return == false) { |
| 358 | 358 | $error++; |
| 359 | 359 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -363,11 +363,11 @@ discard block |
||
| 363 | 363 | if (!$error) { |
| 364 | 364 | // Defined modele of doc |
| 365 | 365 | $last_main_doc_file = $object->last_main_doc; |
| 366 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 366 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 367 | 367 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 368 | 368 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 369 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 370 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 369 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 370 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 371 | 371 | |
| 372 | 372 | if (dol_is_file($sourcefile)) { |
| 373 | 373 | // We build the new PDF |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | |
| 386 | 386 | //$pdf->Open(); |
| 387 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 388 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 387 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 388 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 389 | 389 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 390 | 390 | try { |
| 391 | 391 | $tppl = $pdf->importPage($i); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 394 | 394 | $pdf->useTemplate($tppl); |
| 395 | 395 | } catch (Exception $e) { |
| 396 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 396 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 397 | 397 | $response = $e->getMessage(); |
| 398 | 398 | $error++; |
| 399 | 399 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $xforimgstart = 105; |
| 405 | 405 | $yforimgstart = (empty($s['h']) ? 250 : $s['h'] - 57); |
| 406 | 406 | $wforimg = $s['w'] / 1 - ($xforimgstart + 16); |
| 407 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 407 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 408 | 408 | //$pdf->Close(); |
| 409 | 409 | $pdf->Output($newpdffilename, "F"); |
| 410 | 410 | |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | } elseif ($mode == "societe_rib") { |
| 426 | 426 | $langs->load('withdrawals'); |
| 427 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 428 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 427 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 428 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 429 | 429 | $modelpath = "core/modules/bank/doc/"; |
| 430 | 430 | $object = new CompanyBankAccount($db); |
| 431 | 431 | $object->fetch($ref); |
@@ -433,24 +433,24 @@ discard block |
||
| 433 | 433 | $object->fetch_thirdparty(); |
| 434 | 434 | |
| 435 | 435 | |
| 436 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' |
|
| 437 | - . dol_sanitizeFileName($object->thirdparty->id) . '/'; |
|
| 436 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/' |
|
| 437 | + . dol_sanitizeFileName($object->thirdparty->id).'/'; |
|
| 438 | 438 | |
| 439 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 440 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 439 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 440 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 441 | 441 | $langs->loadLangs(array("main", "companies")); |
| 442 | 442 | |
| 443 | 443 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 444 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 445 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 446 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 447 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 444 | + $filename = "signatures/".$date."_signature.png"; |
|
| 445 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 446 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 447 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 448 | 448 | $error++; |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | if (!$error) { |
| 453 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 453 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 454 | 454 | if ($return == false) { |
| 455 | 455 | $error++; |
| 456 | 456 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -461,14 +461,14 @@ discard block |
||
| 461 | 461 | // Defined modele of doc |
| 462 | 462 | $last_main_doc_file = $object->last_main_doc; |
| 463 | 463 | $last_modelpdf = $object->model_pdf; |
| 464 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 464 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 465 | 465 | |
| 466 | 466 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 467 | 467 | $sourcefile = ''; |
| 468 | 468 | $newpdffilename = ''; |
| 469 | 469 | if ($last_modelpdf == 'sepamandate') { |
| 470 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
| 471 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
| 470 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
| 471 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
| 472 | 472 | } |
| 473 | 473 | if (dol_is_file($sourcefile)) { |
| 474 | 474 | // We build the new PDF |
@@ -484,9 +484,9 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | //$pdf->Open(); |
| 487 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 487 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 488 | 488 | |
| 489 | - $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 489 | + $s = array(); // Array with size of each page. Exemple array(w'=>210, 'h'=>297); |
|
| 490 | 490 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 491 | 491 | try { |
| 492 | 492 | $tppl = $pdf->importPage($i); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 495 | 495 | $pdf->useTemplate($tppl); |
| 496 | 496 | } catch (Exception $e) { |
| 497 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 497 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 498 | 498 | $response = $e->getMessage(); |
| 499 | 499 | $error++; |
| 500 | 500 | } |
@@ -510,12 +510,12 @@ discard block |
||
| 510 | 510 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
| 511 | 511 | } |
| 512 | 512 | foreach ($dirmodels as $reldir) { |
| 513 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
| 513 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
| 514 | 514 | // On vérifie l'emplacement du modele |
| 515 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
| 515 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
| 516 | 516 | if (file_exists($file)) { |
| 517 | 517 | $filefound = $file; |
| 518 | - $classname = 'pdf_' . $last_modelpdf; |
|
| 518 | + $classname = 'pdf_'.$last_modelpdf; |
|
| 519 | 519 | break; |
| 520 | 520 | } |
| 521 | 521 | if ($filefound) { |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | if (!$filefound) { |
| 527 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
| 527 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
| 528 | 528 | dol_syslog($response, LOG_ERR); |
| 529 | 529 | $error++; |
| 530 | 530 | } |
@@ -547,10 +547,10 @@ discard block |
||
| 547 | 547 | $wforimg = $s['w'] - 20 - $xforimgstart; |
| 548 | 548 | |
| 549 | 549 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 550 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
|
| 550 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Lastname").': '.$online_sign_name, 0, 'L'); |
|
| 551 | 551 | |
| 552 | 552 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
| 553 | - $pdf->Image($upload_dir . $filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 553 | + $pdf->Image($upload_dir.$filename, $xforimgstart, $yforimgstart, $wforimg, round($wforimg / 4)); |
|
| 554 | 554 | } |
| 555 | 555 | //$pdf->Close(); |
| 556 | 556 | $pdf->Output($newpdffilename, "F"); |
@@ -576,16 +576,16 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | $online_sign_ip = getUserRemoteIP(); |
| 578 | 578 | |
| 579 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
| 579 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
| 580 | 580 | $sql .= " SET "; |
| 581 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 582 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 581 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 582 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 583 | 583 | if ($online_sign_name) { |
| 584 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 584 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 585 | 585 | } |
| 586 | 586 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
| 587 | 587 | |
| 588 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 588 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 589 | 589 | |
| 590 | 590 | dol_syslog(__FILE__, LOG_DEBUG); |
| 591 | 591 | $resql = $db->query($sql); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | /** |
| 114 | 114 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
| 115 | 115 | */ |
| 116 | - public $fields=array( |
|
| 116 | + public $fields = array( |
|
| 117 | 117 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
| 118 | 118 | 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>17, 'notnull'=>0, 'visible'=>-2,), |
| 119 | 119 | 'import_key' => array('type'=>'varchar(14)', 'label'=>'import_key', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>-1,), |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | $label = $langs->trans("ShowTimeSpent"); |
| 718 | 718 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
| 719 | 719 | } |
| 720 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 720 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
| 721 | 721 | $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; |
| 722 | 722 | } else { |
| 723 | 723 | $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | if (!empty($conf->global->TIMESPENT_timespent_ADDON)) { |
| 945 | 945 | $mybool = false; |
| 946 | 946 | |
| 947 | - $file = getDolGlobalString('TIMESPENT_timespent_ADDON') . ".php"; |
|
| 947 | + $file = getDolGlobalString('TIMESPENT_timespent_ADDON').".php"; |
|
| 948 | 948 | $classname = $conf->global->TIMESPENT_timespent_ADDON; |
| 949 | 949 | |
| 950 | 950 | // Include file with class |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; |
| 471 | 471 | if ($classinstance->id != '') { // id may be 0, it is a found value |
| 472 | 472 | $newval = $classinstance->id; |
| 473 | - } elseif (! $error) { |
|
| 473 | + } elseif (!$error) { |
|
| 474 | 474 | if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { |
| 475 | 475 | $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); |
| 476 | 476 | } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | $classinstance = new $class($this->db); |
| 644 | 644 | $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1))); |
| 645 | 645 | if (empty($classinstance->error) && empty($classinstance->errors)) { |
| 646 | - $newval = $res; // We get new value computed. |
|
| 646 | + $newval = $res; // We get new value computed. |
|
| 647 | 647 | } else { |
| 648 | 648 | $this->errors[$error]['type'] = 'CLASSERROR'; |
| 649 | 649 | $this->errors[$error]['lib'] = implode( |
@@ -741,12 +741,12 @@ discard block |
||
| 741 | 741 | if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { |
| 742 | 742 | if (!in_array("socialnetworks", $listfields)) { |
| 743 | 743 | $listfields[] = "socialnetworks"; |
| 744 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
| 744 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
| 745 | 745 | $listvalues[$socialkey] = ''; |
| 746 | 746 | } |
| 747 | 747 | //var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']); |
| 748 | 748 | if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { |
| 749 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
| 749 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
| 750 | 750 | //var_dump('sk='.$socialkey); // socialkey=19 |
| 751 | 751 | $socialnetwork = explode("_", $fieldname)[1]; |
| 752 | 752 | if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; |
| 808 | 808 | $resultload = dol_include_once($file); |
| 809 | 809 | if (empty($resultload)) { |
| 810 | - dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); |
|
| 810 | + dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method); |
|
| 811 | 811 | break; |
| 812 | 812 | } |
| 813 | 813 | $classinstance = new $class($this->db); |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | $fname = 'rowid'; |
| 852 | 852 | if (strpos($tablename, '_categorie_') !== false) { |
| 853 | 853 | $is_table_category_link = true; |
| 854 | - $fname='*'; |
|
| 854 | + $fname = '*'; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | if (!empty($updatekeys)) { |
@@ -860,8 +860,8 @@ discard block |
||
| 860 | 860 | if (empty($lastinsertid)) { // No insert done yet for a parent table |
| 861 | 861 | $sqlSelect = "SELECT ".$fname." FROM ".$tablename; |
| 862 | 862 | $data = array_combine($listfields, $listvalues); |
| 863 | - $where = array(); // filters to forge SQL request |
|
| 864 | - $filters = array(); // filters to forge output error message |
|
| 863 | + $where = array(); // filters to forge SQL request |
|
| 864 | + $filters = array(); // filters to forge output error message |
|
| 865 | 865 | foreach ($updatekeys as $key) { |
| 866 | 866 | $col = $objimport->array_import_updatekeys[0][$key]; |
| 867 | 867 | $key = preg_replace('/^.*\./i', '', $key); |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | // We db escape social network field because he isn't in field creation |
| 949 | 949 | if (in_array("socialnetworks", $listfields)) { |
| 950 | 950 | $socialkey = array_search("socialnetworks", $listfields); |
| 951 | - $tmpsql = $listvalues[$socialkey]; |
|
| 951 | + $tmpsql = $listvalues[$socialkey]; |
|
| 952 | 952 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
| 953 | 953 | } |
| 954 | 954 | |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | $sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid); |
| 969 | 969 | |
| 970 | 970 | if ($is_table_category_link) { |
| 971 | - $sqlend = " WHERE " . implode(' AND ', $where); |
|
| 971 | + $sqlend = " WHERE ".implode(' AND ', $where); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | if (!empty($tablewithentity_cache[$tablename])) { |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | // We db escape social network field because he isn't in field creation |
| 997 | 997 | if (in_array("socialnetworks", $listfields)) { |
| 998 | 998 | $socialkey = array_search("socialnetworks", $listfields); |
| 999 | - $tmpsql = $listvalues[$socialkey]; |
|
| 999 | + $tmpsql = $listvalues[$socialkey]; |
|
| 1000 | 1000 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
| 1001 | 1001 | } |
| 1002 | 1002 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | if (!empty($conf->global->EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE)) { |
| 199 | 199 | print '<div class="backimagepubliceventorganizationsubscription">'; |
| 200 | - print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">'; |
|
| 200 | + print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('EVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE').'">'; |
|
| 201 | 201 | print '</div>'; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // Action called when page is submitted |
| 238 | -if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status==2 || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { |
|
| 238 | +if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conference->status == 2 || !empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { |
|
| 239 | 239 | $error = 0; |
| 240 | 240 | |
| 241 | 241 | $urlback = ''; |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | // If the registration has already been paid for this attendee |
| 338 | 338 | if (!empty($confattendee->date_subscription) && !empty($confattendee->amount)) { |
| 339 | - $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, 'master'); |
|
| 339 | + $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 'master'); |
|
| 340 | 340 | $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl); |
| 341 | 341 | |
| 342 | 342 | $mesg = $langs->trans("RegistrationAndPaymentWereAlreadyRecorded", $email); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $resultfetchthirdparty = 0; |
| 352 | 352 | |
| 353 | - $genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email); // Keep this label simple so we can retreive same thirdparty for another event |
|
| 353 | + $genericcompanyname = $langs->trans('EventParticipant').' '.($emailcompany ? $emailcompany : $email); // Keep this label simple so we can retreive same thirdparty for another event |
|
| 354 | 354 | |
| 355 | 355 | // Getting the thirdparty or creating it |
| 356 | 356 | $thirdparty = new Societe($db); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.urlencode($sourcetouse).'&ref='.urlencode($reftouse); |
| 604 | 604 | if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { |
| 605 | 605 | if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { |
| 606 | - $redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical |
|
| 606 | + $redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$sourcetouse.$reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical |
|
| 607 | 607 | } else { |
| 608 | 608 | $redirection .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); |
| 609 | 609 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, 2); |
|
| 667 | + $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.$id, 2); |
|
| 668 | 668 | $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl); |
| 669 | 669 | |
| 670 | 670 | Header("Location: ".$redirection); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | print '<span class="opacitymedium">'.$langs->trans("EvntOrgWelcomeMessage").'</span>'; |
| 699 | 699 | print '<br>'; |
| 700 | 700 | // Title |
| 701 | -print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $conference->label).'</span><br>'; |
|
| 701 | +print '<span class="eventlabel large">'.dol_escape_htmltag($project->title.' '.$conference->label).'</span><br>'; |
|
| 702 | 702 | print '</div>'; |
| 703 | 703 | |
| 704 | 704 | // Help text |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | print ' - '; |
| 757 | 757 | print dol_print_date($project->date_end); |
| 758 | 758 | }*/ |
| 759 | - $maxattendees = $project->max_attendees; // Max attendeed for the project/event |
|
| 759 | + $maxattendees = $project->max_attendees; // Max attendeed for the project/event |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | if ($maxattendees && $currentnbofattendees >= $maxattendees) { |
@@ -772,14 +772,14 @@ discard block |
||
| 772 | 772 | if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS_CONFIRMED) || (!empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { |
| 773 | 773 | if (empty($maxattendees) || $currentnbofattendees < $maxattendees) { |
| 774 | 774 | // Print form |
| 775 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="newmember">' . "\n"; |
|
| 776 | - print '<input type="hidden" name="token" value="' . newToken() . '" / >'; |
|
| 777 | - print '<input type="hidden" name="entity" value="' . $entity . '" />'; |
|
| 775 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n"; |
|
| 776 | + print '<input type="hidden" name="token" value="'.newToken().'" / >'; |
|
| 777 | + print '<input type="hidden" name="entity" value="'.$entity.'" />'; |
|
| 778 | 778 | print '<input type="hidden" name="action" value="add" />'; |
| 779 | - print '<input type="hidden" name="type" value="' . $type . '" />'; |
|
| 780 | - print '<input type="hidden" name="id" value="' . $conference->id . '" />'; |
|
| 781 | - print '<input type="hidden" name="fk_project" value="' . $project->id . '" />'; |
|
| 782 | - print '<input type="hidden" name="securekey" value="' . $securekeyreceived . '" />'; |
|
| 779 | + print '<input type="hidden" name="type" value="'.$type.'" />'; |
|
| 780 | + print '<input type="hidden" name="id" value="'.$conference->id.'" />'; |
|
| 781 | + print '<input type="hidden" name="fk_project" value="'.$project->id.'" />'; |
|
| 782 | + print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />'; |
|
| 783 | 783 | |
| 784 | 784 | print '<br>'; |
| 785 | 785 | print '<br>'; |
@@ -799,20 +799,20 @@ discard block |
||
| 799 | 799 | }); |
| 800 | 800 | </script>'; |
| 801 | 801 | |
| 802 | - print '<table class="border" summary="form to subscribe" id="tablesubscribe">' . "\n"; |
|
| 802 | + print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n"; |
|
| 803 | 803 | |
| 804 | 804 | // Firstname |
| 805 | - print '<tr><td><span class="fieldrequired">' . $langs->trans("Firstname") . '</span></td><td>'; |
|
| 806 | - print '<input type="text" name="firstname" maxlength="255" class="minwidth200 maxwidth300" value="' . dol_escape_htmltag($firstname) . '" required></td></tr>' . "\n"; |
|
| 805 | + print '<tr><td><span class="fieldrequired">'.$langs->trans("Firstname").'</span></td><td>'; |
|
| 806 | + print '<input type="text" name="firstname" maxlength="255" class="minwidth200 maxwidth300" value="'.dol_escape_htmltag($firstname).'" required></td></tr>'."\n"; |
|
| 807 | 807 | |
| 808 | 808 | // Lastname |
| 809 | - print '<tr><td><span class="fieldrequired">' . $langs->trans("Lastname") . '</span></td><td>'; |
|
| 810 | - print '<input type="text" name="lastname" maxlength="255" class="minwidth200 maxwidth300" value="' . dol_escape_htmltag($lastname) . '" required></td></tr>' . "\n"; |
|
| 809 | + print '<tr><td><span class="fieldrequired">'.$langs->trans("Lastname").'</span></td><td>'; |
|
| 810 | + print '<input type="text" name="lastname" maxlength="255" class="minwidth200 maxwidth300" value="'.dol_escape_htmltag($lastname).'" required></td></tr>'."\n"; |
|
| 811 | 811 | |
| 812 | 812 | |
| 813 | - print '<tr><td><span class="fieldrequired">' . $langs->trans("EmailAttendee") . '</span></td><td>'; |
|
| 813 | + print '<tr><td><span class="fieldrequired">'.$langs->trans("EmailAttendee").'</span></td><td>'; |
|
| 814 | 814 | print img_picto('', 'email', 'class="pictofixedwidth"'); |
| 815 | - print '<input type="text" name="email" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('email')) . '" required></td></tr>' . "\n"; |
|
| 815 | + print '<input type="text" name="email" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('email')).'" required></td></tr>'."\n"; |
|
| 816 | 816 | |
| 817 | 817 | // Company |
| 818 | 818 | print '<tr id="trcompany" class="trcompany"><td>'; |
@@ -825,21 +825,21 @@ discard block |
||
| 825 | 825 | } |
| 826 | 826 | print '</td><td>'; |
| 827 | 827 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
| 828 | - print '<input type="text" name="societe" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('societe')) . '"'.(empty(floatval($project->price_registration)) ? '' : ' required').'></td></tr>' . "\n"; |
|
| 828 | + print '<input type="text" name="societe" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('societe')).'"'.(empty(floatval($project->price_registration)) ? '' : ' required').'></td></tr>'."\n"; |
|
| 829 | 829 | |
| 830 | 830 | // Email company for invoice |
| 831 | 831 | if ($project->price_registration) { |
| 832 | - print '<tr><td>' . $form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")) . '</td><td>'; |
|
| 832 | + print '<tr><td>'.$form->textwithpicto($langs->trans("EmailCompany"), $langs->trans("EmailCompanyForInvoice")).'</td><td>'; |
|
| 833 | 833 | print img_picto('', 'email', 'class="pictofixedwidth"'); |
| 834 | - print '<input type="text" name="emailcompany" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="' . dol_escape_htmltag(GETPOST('emailcompany')) . '"></td></tr>' . "\n"; |
|
| 834 | + print '<input type="text" name="emailcompany" maxlength="255" class="minwidth200 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOST('emailcompany')).'"></td></tr>'."\n"; |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | // Address |
| 838 | - print '<tr><td>' . $langs->trans("Address") . '</td><td>' . "\n"; |
|
| 839 | - print '<textarea name="address" id="address" wrap="soft" class="centpercent" rows="' . ROWS_2 . '">' . dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1) . '</textarea></td></tr>' . "\n"; |
|
| 838 | + print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n"; |
|
| 839 | + print '<textarea name="address" id="address" wrap="soft" class="centpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n"; |
|
| 840 | 840 | |
| 841 | 841 | // Zip / Town |
| 842 | - print '<tr><td>' . $langs->trans('Zip') . ' / ' . $langs->trans('Town') . '</td><td>'; |
|
| 842 | + print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>'; |
|
| 843 | 843 | print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); |
| 844 | 844 | print ' / '; |
| 845 | 845 | print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | print '</td></tr>'; |
| 869 | 869 | // State |
| 870 | 870 | if (empty($conf->global->SOCIETE_DISABLE_STATE)) { |
| 871 | - print '<tr><td>' . $langs->trans('State') . '</td><td>'; |
|
| 871 | + print '<tr><td>'.$langs->trans('State').'</td><td>'; |
|
| 872 | 872 | if ($country_code) { |
| 873 | 873 | print img_picto('', 'state', 'class="pictofixedwidth"'); |
| 874 | 874 | print $formcompany->select_state(GETPOST("state_id"), $country_code); |
@@ -879,13 +879,13 @@ discard block |
||
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | if ($project->price_registration) { |
| 882 | - print '<tr><td>' . $langs->trans('Price') . '</td><td>'; |
|
| 882 | + print '<tr><td>'.$langs->trans('Price').'</td><td>'; |
|
| 883 | 883 | print '<span class="amount price-registration">'.price($project->price_registration, 1, $langs, 1, -1, -1, $conf->currency).'</span>'; |
| 884 | 884 | print '</td></tr>'; |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | $notetoshow = $note_public; |
| 888 | - print '<tr><td>' . $langs->trans('Note') . '</td><td>'; |
|
| 888 | + print '<tr><td>'.$langs->trans('Note').'</td><td>'; |
|
| 889 | 889 | if (!empty($conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION)) { |
| 890 | 890 | $notetoshow = str_replace('\n', "\n", $conf->global->EVENTORGANIZATION_DEFAULT_NOTE_ON_REGISTRATION); |
| 891 | 891 | } |
@@ -898,9 +898,9 @@ discard block |
||
| 898 | 898 | |
| 899 | 899 | // Save |
| 900 | 900 | print '<div class="center">'; |
| 901 | - print '<input type="submit" value="' . $langs->trans("Submit") . '" id="submitsave" class="button">'; |
|
| 901 | + print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">'; |
|
| 902 | 902 | if (!empty($backtopage)) { |
| 903 | - print ' <input type="submit" value="' . $langs->trans("Cancel") . '" id="submitcancel" class="button button-cancel">'; |
|
| 903 | + print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">'; |
|
| 904 | 904 | } |
| 905 | 905 | print '</div>'; |
| 906 | 906 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
| 114 | 114 | */ |
| 115 | - public $fields=array( |
|
| 115 | + public $fields = array( |
|
| 116 | 116 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
| 117 | 117 | 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"BookcalLabelAvailabilityHelp", 'showoncombobox'=>'2', 'validate'=>'1',), |
| 118 | 118 | 'fk_bookcal_calendar' => array('type'=>'integer:Calendar:bookcal/class/calendar.class.php:1', 'label'=>'Calendar', 'enabled'=>'1', 'position'=>25, 'notnull'=>1, 'visible'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'), |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | if (!empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) { |
| 997 | 997 | $mybool = false; |
| 998 | 998 | |
| 999 | - $file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON') . ".php"; |
|
| 999 | + $file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON').".php"; |
|
| 1000 | 1000 | $classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON; |
| 1001 | 1001 | |
| 1002 | 1002 | // Include file with class |