@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | $action = GETPOST('action', 'aZ09'); |
38 | 38 | $value = GETPOST('value', 'alpha'); |
39 | -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
39 | +$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php |
|
40 | 40 | |
41 | 41 | $param = GETPOST('param', 'alpha'); |
42 | 42 | $cancel = GETPOST('cancel', 'alpha'); |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | while ($assoc = $db->fetch_array($resql)) { |
802 | 802 | $rate_key = $assoc['rate']; |
803 | 803 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
804 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
804 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | // Code to avoid warnings when array entry not defined |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | while ($assoc = $db->fetch_array($resql)) { |
987 | 987 | $rate_key = $assoc['rate']; |
988 | 988 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
989 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
989 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | // Code to avoid warnings when array entry not defined |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | while ($assoc = $db->fetch_array($resql)) { |
1114 | 1114 | $rate_key = $assoc['rate']; |
1115 | 1115 | if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) { |
1116 | - $rate_key .= ' (' . $assoc['vat_src_code'] . ')'; |
|
1116 | + $rate_key .= ' ('.$assoc['vat_src_code'].')'; |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | // Code to avoid warnings when array entry not defined |
@@ -29,16 +29,28 @@ discard block |
||
29 | 29 | // Load Dolibarr environment |
30 | 30 | $res = 0; |
31 | 31 | // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) |
32 | -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
32 | +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { |
|
33 | + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; |
|
34 | +} |
|
33 | 35 | // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME |
34 | 36 | $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; |
35 | 37 | while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } |
36 | -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
37 | -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
38 | +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { |
|
39 | + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; |
|
40 | +} |
|
41 | +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { |
|
42 | + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; |
|
43 | +} |
|
38 | 44 | // Try main.inc.php using relative path |
39 | -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; |
|
40 | -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; |
|
41 | -if (!$res) die("Include of main fails"); |
|
45 | +if (!$res && file_exists("../../main.inc.php")) { |
|
46 | + $res = @include "../../main.inc.php"; |
|
47 | +} |
|
48 | +if (!$res && file_exists("../../../main.inc.php")) { |
|
49 | + $res = @include "../../../main.inc.php"; |
|
50 | +} |
|
51 | +if (!$res) { |
|
52 | + die("Include of main fails"); |
|
53 | +} |
|
42 | 54 | |
43 | 55 | require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
44 | 56 | require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; |
@@ -52,13 +64,17 @@ discard block |
||
52 | 64 | // List of supported format |
53 | 65 | $tmptype2label = ExtraFields::$type2label; |
54 | 66 | $type2label = array(''); |
55 | -foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
67 | +foreach ($tmptype2label as $key => $val) { |
|
68 | + $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
69 | +} |
|
56 | 70 | |
57 | 71 | $action = GETPOST('action', 'aZ09'); |
58 | 72 | $attrname = GETPOST('attrname', 'alpha'); |
59 | 73 | $elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield |
60 | 74 | |
61 | -if (!$user->admin) accessforbidden(); |
|
75 | +if (!$user->admin) { |
|
76 | + accessforbidden(); |
|
77 | +} |
|
62 | 78 | |
63 | 79 | |
64 | 80 | /* |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | } |
160 | 160 | $sql .= "("; |
161 | 161 | $sql .= " SELECT cp.fk_categorie, cp.fk_product"; |
162 | - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp"; |
|
162 | + $sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp"; |
|
163 | 163 | $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ |
164 | 164 | if ($search_categ > 0) { |
165 | - $sql .= " AND cp.fk_categorie = " . ((int) $search_categ); |
|
165 | + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); |
|
166 | 166 | } |
167 | 167 | $sql .= ")"; |
168 | 168 | } |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | } |
211 | 211 | if ($search_stock_physique != '') { |
212 | 212 | //$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
213 | - $natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1); |
|
214 | - $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
213 | + $natural_search_physique = natural_search('SUM('.$db->ifsql('s.reel IS NULL', '0', 's.reel').')', $search_stock_physique, 1, 1); |
|
214 | + $natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters |
|
215 | 215 | if (!empty($sql_having)) { |
216 | 216 | $sql_having .= " AND"; |
217 | 217 | } else { |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $param .= "&sbarcode=".urlencode($sbarcode); |
299 | 299 | } |
300 | 300 | if ($search_stock_physique) { |
301 | - $param .= '&search_stock_physique=' . urlencode($search_stock_physique); |
|
301 | + $param .= '&search_stock_physique='.urlencode($search_stock_physique); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | llxHeader("", $texte, $helpurl); |
@@ -156,7 +156,7 @@ |
||
156 | 156 | * $price Can be set to update AWP (Average Weighted Price) when you make a stock increase |
157 | 157 | * $dlc Eat-by date. Will be used if lot does not exists yet and will be created. |
158 | 158 | * $dluo Sell-by date. Will be used if lot does not exists yet and will be created. |
159 | - * |
|
159 | + * |
|
160 | 160 | * @param int $product_id Id product id {@min 1} {@from body} {@required true} |
161 | 161 | * @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true} |
162 | 162 | * @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true} |
@@ -954,7 +954,7 @@ |
||
954 | 954 | } |
955 | 955 | $result .= $linkend; |
956 | 956 | global $action; |
957 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
957 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
958 | 958 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
959 | 959 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
960 | 960 | if ($reshook > 0) { |
@@ -715,12 +715,12 @@ |
||
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
718 | - * Return clicable link of object (with eventually picto) |
|
719 | - * |
|
720 | - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
721 | - * @param array $arraydata Array of data |
|
722 | - * @return string HTML Code for Kanban thumb. |
|
723 | - */ |
|
718 | + * Return clicable link of object (with eventually picto) |
|
719 | + * |
|
720 | + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
721 | + * @param array $arraydata Array of data |
|
722 | + * @return string HTML Code for Kanban thumb. |
|
723 | + */ |
|
724 | 724 | public function getKanbanView($option = '', $arraydata = null) |
725 | 725 | { |
726 | 726 | global $langs; |
@@ -914,11 +914,11 @@ |
||
914 | 914 | |
915 | 915 | |
916 | 916 | /** |
917 | - * Load the info information in the object |
|
918 | - * |
|
919 | - * @param int $id Id of object |
|
920 | - * @return void |
|
921 | - */ |
|
917 | + * Load the info information in the object |
|
918 | + * |
|
919 | + * @param int $id Id of object |
|
920 | + * @return void |
|
921 | + */ |
|
922 | 922 | public function info($id) |
923 | 923 | { |
924 | 924 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Put here all includes required by your class file |
29 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
30 | 30 | //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
31 | 31 | //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
32 | 32 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
104 | 104 | */ |
105 | - public $fields=array( |
|
105 | + public $fields = array( |
|
106 | 106 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
107 | 107 | //'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), |
108 | 108 | 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | |
269 | 269 | // Clear fields |
270 | 270 | if (property_exists($object, 'ref')) { |
271 | - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_" . $object->ref : $this->fields['ref']['default']; |
|
271 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
272 | 272 | } |
273 | 273 | if (property_exists($object, 'label')) { |
274 | - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf") . " " . $object->label : $this->fields['label']['default']; |
|
274 | + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
275 | 275 | } |
276 | 276 | if (property_exists($object, 'status')) { |
277 | 277 | $object->status = self::STATUS_DRAFT; |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | |
384 | 384 | $sql = 'SELECT '; |
385 | 385 | $sql .= $this->getFieldList('t'); |
386 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
386 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
387 | 387 | if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
388 | - $sql .= ' WHERE t.entity IN (' . getEntity($this->element) . ')'; |
|
388 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
389 | 389 | } else { |
390 | 390 | $sql .= ' WHERE 1 = 1'; |
391 | 391 | } |
@@ -394,15 +394,15 @@ discard block |
||
394 | 394 | if (count($filter) > 0) { |
395 | 395 | foreach ($filter as $key => $value) { |
396 | 396 | if ($key == 't.rowid') { |
397 | - $sqlwhere[] = $key . '=' . $value; |
|
397 | + $sqlwhere[] = $key.'='.$value; |
|
398 | 398 | } elseif ($key == 'customsql') { |
399 | 399 | $sqlwhere[] = $value; |
400 | 400 | } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { |
401 | - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; |
|
401 | + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; |
|
402 | 402 | } elseif (strpos($value, '%') === false) { |
403 | - $sqlwhere[] = $key . ' IN (' . $this->db->sanitize($this->db->escape($value)) . ')'; |
|
403 | + $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; |
|
404 | 404 | } else { |
405 | - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; |
|
405 | + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $sql .= $this->db->order($sortfield, $sortorder); |
415 | 415 | } |
416 | 416 | if (!empty($limit)) { |
417 | - $sql .= ' ' . $this->db->plimit($limit, $offset); |
|
417 | + $sql .= ' '.$this->db->plimit($limit, $offset); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | $resql = $this->db->query($sql); |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | |
436 | 436 | return $records; |
437 | 437 | } else { |
438 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
439 | - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
438 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
439 | + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); |
|
440 | 440 | |
441 | 441 | return -1; |
442 | 442 | } |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | { |
498 | 498 | global $conf, $langs; |
499 | 499 | |
500 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
500 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
501 | 501 | |
502 | 502 | $error = 0; |
503 | 503 | |
504 | 504 | // Protection |
505 | 505 | if ($this->status == self::STATUS_VALIDATED) { |
506 | - dol_syslog(get_class($this) . "::validate action abandonned: already validated", LOG_WARNING); |
|
506 | + dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); |
|
507 | 507 | return 0; |
508 | 508 | } |
509 | 509 | |
@@ -529,18 +529,18 @@ discard block |
||
529 | 529 | |
530 | 530 | if (!empty($num)) { |
531 | 531 | // Validate |
532 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element; |
|
533 | - $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
|
534 | - $sql .= " status = " . self::STATUS_VALIDATED; |
|
532 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
533 | + $sql .= " SET ref = '".$this->db->escape($num)."',"; |
|
534 | + $sql .= " status = ".self::STATUS_VALIDATED; |
|
535 | 535 | if (!empty($this->fields['date_validation'])) { |
536 | - $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; |
|
536 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
537 | 537 | } |
538 | 538 | if (!empty($this->fields['fk_user_valid'])) { |
539 | - $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
539 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
540 | 540 | } |
541 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
541 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
542 | 542 | |
543 | - dol_syslog(get_class($this) . "::validate()", LOG_DEBUG); |
|
543 | + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
|
544 | 544 | $resql = $this->db->query($sql); |
545 | 545 | if (!$resql) { |
546 | 546 | dol_print_error($this->db); |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | // Rename directory if dir was a temporary ref |
565 | 565 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
566 | 566 | // Now we rename also files into index |
567 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'position/" . $this->db->escape($this->newref) . "'"; |
|
568 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'position/" . $this->db->escape($this->ref) . "' and entity = " . $conf->entity; |
|
567 | + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'position/".$this->db->escape($this->newref)."'"; |
|
568 | + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'position/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; |
|
569 | 569 | $resql = $this->db->query($sql); |
570 | 570 | if (!$resql) { |
571 | 571 | $error++; |
@@ -581,20 +581,20 @@ discard block |
||
581 | 581 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
582 | 582 | $oldref = dol_sanitizeFileName($this->ref); |
583 | 583 | $newref = dol_sanitizeFileName($num); |
584 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
585 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
584 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
585 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
586 | 586 | if (!$error && file_exists($dirsource)) { |
587 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
587 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
588 | 588 | |
589 | 589 | if (@rename($dirsource, $dirdest)) { |
590 | 590 | dol_syslog("Rename ok"); |
591 | 591 | // Rename docs starting with $oldref with $newref |
592 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
592 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
593 | 593 | foreach ($listoffiles as $fileentry) { |
594 | 594 | $dirsource = $fileentry['name']; |
595 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
596 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
597 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
595 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
596 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
597 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
598 | 598 | @rename($dirsource, $dirdest); |
599 | 599 | } |
600 | 600 | } |
@@ -710,14 +710,14 @@ discard block |
||
710 | 710 | |
711 | 711 | $result = ''; |
712 | 712 | |
713 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
713 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
714 | 714 | if (isset($this->status)) { |
715 | - $label .= ' ' . $this->getLibStatut(5); |
|
715 | + $label .= ' '.$this->getLibStatut(5); |
|
716 | 716 | } |
717 | 717 | $label .= '<br>'; |
718 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
718 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
719 | 719 | |
720 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
720 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
721 | 721 | |
722 | 722 | if ($option != 'nolink') { |
723 | 723 | // Add param to save lastsearch_values or not |
@@ -734,20 +734,20 @@ discard block |
||
734 | 734 | if (empty($notooltip)) { |
735 | 735 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
736 | 736 | $label = $langs->trans("ShowPosition"); |
737 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
737 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
738 | 738 | } |
739 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
740 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
739 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
740 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
741 | 741 | } else { |
742 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
742 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | if ($option == 'nolink') { |
746 | 746 | $linkstart = '<span'; |
747 | 747 | } else { |
748 | - $linkstart = '<a href="' . $url . '"'; |
|
748 | + $linkstart = '<a href="'.$url.'"'; |
|
749 | 749 | } |
750 | - $linkstart .= $linkclose . '>'; |
|
750 | + $linkstart .= $linkclose.'>'; |
|
751 | 751 | if ($option == 'nolink') { |
752 | 752 | $linkend = '</span>'; |
753 | 753 | } else { |
@@ -758,29 +758,29 @@ discard block |
||
758 | 758 | |
759 | 759 | if (empty($this->showphoto_on_popup)) { |
760 | 760 | if ($withpicto) { |
761 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
761 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
762 | 762 | } |
763 | 763 | } else { |
764 | 764 | if ($withpicto) { |
765 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
765 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
766 | 766 | |
767 | 767 | list($class, $module) = explode('@', $this->picto); |
768 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
768 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
769 | 769 | $filearray = dol_dir_list($upload_dir, "files"); |
770 | 770 | $filename = $filearray[0]['name']; |
771 | 771 | if (!empty($filename)) { |
772 | 772 | $pospoint = strpos($filearray[0]['name'], '.'); |
773 | 773 | |
774 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
775 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
776 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
774 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
775 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
776 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
777 | 777 | } else { |
778 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
778 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | $result .= '</div>'; |
782 | 782 | } else { |
783 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
783 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | } |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
844 | 844 | } |
845 | 845 | |
846 | - $statusType = 'status' . $status; |
|
846 | + $statusType = 'status'.$status; |
|
847 | 847 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
848 | 848 | if ($status == self::STATUS_CANCELED) { |
849 | 849 | $statusType = 'status6'; |
@@ -933,8 +933,8 @@ discard block |
||
933 | 933 | { |
934 | 934 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
935 | 935 | $sql .= ' fk_user_creat, fk_user_modif'; |
936 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
937 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
936 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
937 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
938 | 938 | $result = $this->db->query($sql); |
939 | 939 | if ($result) { |
940 | 940 | if ($this->db->num_rows($result)) { |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | $this->lines = array(); |
980 | 980 | |
981 | 981 | $objectline = new PositionLine($this->db); |
982 | - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); |
|
982 | + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = '.$this->id)); |
|
983 | 983 | |
984 | 984 | if (is_numeric($result)) { |
985 | 985 | $this->error = $objectline->error; |
@@ -1008,20 +1008,20 @@ discard block |
||
1008 | 1008 | if (getDolGlobalString('hrm_POSITION_ADDON')) { |
1009 | 1009 | $mybool = false; |
1010 | 1010 | |
1011 | - $file = getDolGlobalString('hrm_POSITION_ADDON') . ".php"; |
|
1011 | + $file = getDolGlobalString('hrm_POSITION_ADDON').".php"; |
|
1012 | 1012 | $classname = $conf->global->hrm_POSITION_ADDON; |
1013 | 1013 | |
1014 | 1014 | // Include file with class |
1015 | 1015 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
1016 | 1016 | foreach ($dirmodels as $reldir) { |
1017 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
1017 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
1018 | 1018 | |
1019 | 1019 | // Load file with numbering class (if found) |
1020 | - $mybool |= @include_once $dir . $file; |
|
1020 | + $mybool |= @include_once $dir.$file; |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | if ($mybool === false) { |
1024 | - dol_print_error('', "Failed to include file " . $file); |
|
1024 | + dol_print_error('', "Failed to include file ".$file); |
|
1025 | 1025 | return ''; |
1026 | 1026 | } |
1027 | 1027 | |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | return ""; |
1038 | 1038 | } |
1039 | 1039 | } else { |
1040 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
1040 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
1041 | 1041 | return ""; |
1042 | 1042 | } |
1043 | 1043 | } else { |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | $TPosition = array(); |
1058 | 1058 | |
1059 | - $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user=' . $userid)); |
|
1059 | + $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user='.$userid)); |
|
1060 | 1060 | |
1061 | 1061 | return $TPosition; |
1062 | 1062 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | |
1173 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
1173 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
1174 | 1174 | |
1175 | 1175 | /** |
1176 | 1176 | * Class PositionLine. You can also remove this and generate a CRUD class for lines objects. |
@@ -987,7 +987,7 @@ |
||
987 | 987 | $result .= $linkend; |
988 | 988 | |
989 | 989 | global $action; |
990 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
990 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
991 | 991 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
992 | 992 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
993 | 993 | if ($reshook > 0) { |
@@ -954,7 +954,7 @@ |
||
954 | 954 | } |
955 | 955 | $result .= $linkend; |
956 | 956 | global $action; |
957 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
957 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
958 | 958 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
959 | 959 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
960 | 960 | if ($reshook > 0) { |
@@ -751,12 +751,12 @@ |
||
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
754 | - * Return clicable link of object (with eventually picto) |
|
755 | - * |
|
756 | - * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
757 | - * @param array $arraydata Array of data |
|
758 | - * @return string HTML Code for Kanban thumb. |
|
759 | - */ |
|
754 | + * Return clicable link of object (with eventually picto) |
|
755 | + * |
|
756 | + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) |
|
757 | + * @param array $arraydata Array of data |
|
758 | + * @return string HTML Code for Kanban thumb. |
|
759 | + */ |
|
760 | 760 | public function getKanbanView($option = '', $arraydata = null) |
761 | 761 | { |
762 | 762 | global $conf, $langs; |