@@ -740,7 +740,9 @@ |
||
740 | 740 | $this->fetch_origin(); |
741 | 741 | if (empty($this->commandeFournisseur->lines)) { |
742 | 742 | $res = $this->commandeFournisseur->fetch_lines(); |
743 | - if ($res < 0) return $res; |
|
743 | + if ($res < 0) { |
|
744 | + return $res; |
|
745 | + } |
|
744 | 746 | } |
745 | 747 | } |
746 | 748 |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | $result .= $linkend; |
1265 | 1265 | |
1266 | 1266 | global $action; |
1267 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1267 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1268 | 1268 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
1269 | 1269 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1270 | 1270 | if ($reshook > 0) { |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { |
1311 | 1311 | $this->labelStatus[1] = 'StatusReceptionValidatedToReceive'; |
1312 | 1312 | } |
1313 | - $this->labelStatus[2] = 'StatusReceptionProcessed'; |
|
1313 | + $this->labelStatus[2] = 'StatusReceptionProcessed'; |
|
1314 | 1314 | |
1315 | 1315 | // List of short language codes for status |
1316 | 1316 | $this->labelStatusShort[-1] = 'StatusReceptionCanceledShort'; |
@@ -1381,7 +1381,7 @@ discard block |
||
1381 | 1381 | while ($xnbp < $nbp) { |
1382 | 1382 | $line = new CommandeFournisseurDispatch($this->db); |
1383 | 1383 | $line->desc = $langs->trans("Description")." ".$xnbp; |
1384 | - $line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated |
|
1384 | + $line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated |
|
1385 | 1385 | $line->label = $langs->trans("Description")." ".$xnbp; |
1386 | 1386 | $line->qty = 10; |
1387 | 1387 |
@@ -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++; |
@@ -575,20 +575,20 @@ discard block |
||
575 | 575 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
576 | 576 | $oldref = dol_sanitizeFileName($this->ref); |
577 | 577 | $newref = dol_sanitizeFileName($num); |
578 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
579 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
578 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
579 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
580 | 580 | if (!$error && file_exists($dirsource)) { |
581 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
581 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
582 | 582 | |
583 | 583 | if (@rename($dirsource, $dirdest)) { |
584 | 584 | dol_syslog("Rename ok"); |
585 | 585 | // Rename docs starting with $oldref with $newref |
586 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
586 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
587 | 587 | foreach ($listoffiles as $fileentry) { |
588 | 588 | $dirsource = $fileentry['name']; |
589 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
590 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
591 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
589 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
590 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
591 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
592 | 592 | @rename($dirsource, $dirdest); |
593 | 593 | } |
594 | 594 | } |
@@ -704,14 +704,14 @@ discard block |
||
704 | 704 | |
705 | 705 | $result = ''; |
706 | 706 | |
707 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
707 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
708 | 708 | if (isset($this->status)) { |
709 | - $label .= ' ' . $this->getLibStatut(5); |
|
709 | + $label .= ' '.$this->getLibStatut(5); |
|
710 | 710 | } |
711 | 711 | $label .= '<br>'; |
712 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
712 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
713 | 713 | |
714 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
714 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
715 | 715 | |
716 | 716 | if ($option != 'nolink') { |
717 | 717 | // Add param to save lastsearch_values or not |
@@ -728,20 +728,20 @@ discard block |
||
728 | 728 | if (empty($notooltip)) { |
729 | 729 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
730 | 730 | $label = $langs->trans("ShowPosition"); |
731 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
731 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
732 | 732 | } |
733 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
734 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
733 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
734 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
735 | 735 | } else { |
736 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
736 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | if ($option == 'nolink') { |
740 | 740 | $linkstart = '<span'; |
741 | 741 | } else { |
742 | - $linkstart = '<a href="' . $url . '"'; |
|
742 | + $linkstart = '<a href="'.$url.'"'; |
|
743 | 743 | } |
744 | - $linkstart .= $linkclose . '>'; |
|
744 | + $linkstart .= $linkclose.'>'; |
|
745 | 745 | if ($option == 'nolink') { |
746 | 746 | $linkend = '</span>'; |
747 | 747 | } else { |
@@ -752,29 +752,29 @@ discard block |
||
752 | 752 | |
753 | 753 | if (empty($this->showphoto_on_popup)) { |
754 | 754 | if ($withpicto) { |
755 | - $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); |
|
755 | + $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); |
|
756 | 756 | } |
757 | 757 | } else { |
758 | 758 | if ($withpicto) { |
759 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
759 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
760 | 760 | |
761 | 761 | list($class, $module) = explode('@', $this->picto); |
762 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
762 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
763 | 763 | $filearray = dol_dir_list($upload_dir, "files"); |
764 | 764 | $filename = $filearray[0]['name']; |
765 | 765 | if (!empty($filename)) { |
766 | 766 | $pospoint = strpos($filearray[0]['name'], '.'); |
767 | 767 | |
768 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
769 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
770 | - $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>'; |
|
768 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
769 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
770 | + $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>'; |
|
771 | 771 | } else { |
772 | - $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>'; |
|
772 | + $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>'; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | $result .= '</div>'; |
776 | 776 | } else { |
777 | - $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); |
|
777 | + $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); |
|
778 | 778 | } |
779 | 779 | } |
780 | 780 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
834 | 834 | } |
835 | 835 | |
836 | - $statusType = 'status' . $status; |
|
836 | + $statusType = 'status'.$status; |
|
837 | 837 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
838 | 838 | if ($status == self::STATUS_CANCELED) { |
839 | 839 | $statusType = 'status6'; |
@@ -923,8 +923,8 @@ discard block |
||
923 | 923 | { |
924 | 924 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
925 | 925 | $sql .= ' fk_user_creat, fk_user_modif'; |
926 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
927 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
926 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
927 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
928 | 928 | $result = $this->db->query($sql); |
929 | 929 | if ($result) { |
930 | 930 | if ($this->db->num_rows($result)) { |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | $this->lines = array(); |
969 | 969 | |
970 | 970 | $objectline = new PositionLine($this->db); |
971 | - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); |
|
971 | + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = '.$this->id)); |
|
972 | 972 | |
973 | 973 | if (is_numeric($result)) { |
974 | 974 | $this->error = $objectline->error; |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | if (!empty($conf->global->hrm_POSITION_ADDON)) { |
998 | 998 | $mybool = false; |
999 | 999 | |
1000 | - $file = $conf->global->hrm_POSITION_ADDON . ".php"; |
|
1000 | + $file = $conf->global->hrm_POSITION_ADDON.".php"; |
|
1001 | 1001 | $classname = $conf->global->hrm_POSITION_ADDON; |
1002 | 1002 | |
1003 | 1003 | // Include file with class |
1004 | 1004 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
1005 | 1005 | foreach ($dirmodels as $reldir) { |
1006 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
1006 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
1007 | 1007 | |
1008 | 1008 | // Load file with numbering class (if found) |
1009 | - $mybool |= @include_once $dir . $file; |
|
1009 | + $mybool |= @include_once $dir.$file; |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | if ($mybool === false) { |
1013 | - dol_print_error('', "Failed to include file " . $file); |
|
1013 | + dol_print_error('', "Failed to include file ".$file); |
|
1014 | 1014 | return ''; |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | return ""; |
1027 | 1027 | } |
1028 | 1028 | } else { |
1029 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
1029 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
1030 | 1030 | return ""; |
1031 | 1031 | } |
1032 | 1032 | } else { |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | { |
1046 | 1046 | $TPosition = array(); |
1047 | 1047 | |
1048 | - $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user=' . $userid)); |
|
1048 | + $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user='.$userid)); |
|
1049 | 1049 | |
1050 | 1050 | return $TPosition; |
1051 | 1051 | } |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | |
1162 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
1162 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
1163 | 1163 | |
1164 | 1164 | /** |
1165 | 1165 | * 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; |
@@ -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) { |
@@ -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 = 'inventory'; //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 | /* |
@@ -38,9 +38,9 @@ |
||
38 | 38 | // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode. |
39 | 39 | |
40 | 40 | $err = error_reporting(); |
41 | -error_reporting(0); // Disable all errors |
|
41 | +error_reporting(0); // Disable all errors |
|
42 | 42 | //error_reporting(E_ALL); |
43 | -@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 |
|
43 | +@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64 |
|
44 | 44 | error_reporting($err); |
45 | 45 | |
46 | 46 | $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | // Object card |
93 | 93 | // ------------------------------------------------------------ |
94 | - $linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
94 | + $linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
95 | 95 | |
96 | 96 | $morehtmlref = '<div class="refidno">'; |
97 | 97 | $morehtmlref .= '</div>'; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | |
107 | 107 | $cssclass = "titlefield"; |
108 | - include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php'; |
|
108 | + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; |
|
109 | 109 | |
110 | 110 | print '</div>'; |
111 | 111 |
@@ -55,10 +55,14 @@ |
||
55 | 55 | $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php |
56 | 56 | |
57 | 57 | // Security check (enable the most restrictive one) |
58 | -if ($user->socid > 0) accessforbidden(); |
|
58 | +if ($user->socid > 0) { |
|
59 | + accessforbidden(); |
|
60 | +} |
|
59 | 61 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
60 | 62 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
61 | -if (!isModEnabled('asset')) accessforbidden(); |
|
63 | +if (!isModEnabled('asset')) { |
|
64 | + accessforbidden(); |
|
65 | +} |
|
62 | 66 | |
63 | 67 | |
64 | 68 | /* |
@@ -91,7 +91,7 @@ |
||
91 | 91 | |
92 | 92 | // Object card |
93 | 93 | // ------------------------------------------------------------ |
94 | - $linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
94 | + $linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
95 | 95 | |
96 | 96 | $morehtmlref = '<div class="refidno">'; |
97 | 97 | $morehtmlref .= '</div>'; |
@@ -55,11 +55,17 @@ |
||
55 | 55 | $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php |
56 | 56 | |
57 | 57 | // Security check (enable the most restrictive one) |
58 | -if ($user->socid > 0) accessforbidden(); |
|
58 | +if ($user->socid > 0) { |
|
59 | + accessforbidden(); |
|
60 | +} |
|
59 | 61 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
60 | 62 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
61 | -if (!isModEnabled('asset')) accessforbidden(); |
|
62 | -if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden(); |
|
63 | +if (!isModEnabled('asset')) { |
|
64 | + accessforbidden(); |
|
65 | +} |
|
66 | +if (!isset($object->disposal_date) || $object->disposal_date === "") { |
|
67 | + accessforbidden(); |
|
68 | +} |
|
63 | 69 | |
64 | 70 | |
65 | 71 | /* |