@@ -42,8 +42,12 @@ |
||
42 | 42 | //if ($user->socid > 0) $socid = $user->socid; |
43 | 43 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
44 | 44 | //restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0); |
45 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
46 | -if (empty($permissiontoread)) accessforbidden(); |
|
45 | +if (empty($conf->hrm->enabled)) { |
|
46 | + accessforbidden(); |
|
47 | +} |
|
48 | +if (empty($permissiontoread)) { |
|
49 | + accessforbidden(); |
|
50 | +} |
|
47 | 51 | |
48 | 52 | |
49 | 53 | /* |
@@ -85,8 +85,12 @@ |
||
85 | 85 | //if ($user->socid > 0) $socid = $user->socid; |
86 | 86 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
87 | 87 | //restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', $isdraft); |
88 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
89 | -if (empty($permissiontoread)) accessforbidden(); |
|
88 | +if (empty($conf->hrm->enabled)) { |
|
89 | + accessforbidden(); |
|
90 | +} |
|
91 | +if (empty($permissiontoread)) { |
|
92 | + accessforbidden(); |
|
93 | +} |
|
90 | 94 | |
91 | 95 | |
92 | 96 | /* |
@@ -42,8 +42,12 @@ |
||
42 | 42 | //if ($user->socid > 0) $socid = $user->socid; |
43 | 43 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
44 | 44 | //restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0); |
45 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
46 | -if (empty($permissiontoread)) accessforbidden(); |
|
45 | +if (empty($conf->hrm->enabled)) { |
|
46 | + accessforbidden(); |
|
47 | +} |
|
48 | +if (empty($permissiontoread)) { |
|
49 | + accessforbidden(); |
|
50 | +} |
|
47 | 51 | |
48 | 52 | |
49 | 53 | /* |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * \brief Page to edit absolute discounts for a customer |
25 | 25 | */ |
26 | 26 | |
27 | -if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
|
27 | +if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
|
28 | 28 | |
29 | 29 | require '../main.inc.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -24,7 +24,10 @@ |
||
24 | 24 | * \brief Page to edit absolute discounts for a customer |
25 | 25 | */ |
26 | 26 | |
27 | -if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
|
27 | +if (! defined('CSRFCHECK_WITH_TOKEN')) { |
|
28 | + define('CSRFCHECK_WITH_TOKEN', '1'); |
|
29 | +} |
|
30 | +// Force use of CSRF protection with tokens even for GET |
|
28 | 31 | |
29 | 32 | require '../main.inc.php'; |
30 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
@@ -568,7 +568,9 @@ discard block |
||
568 | 568 | |
569 | 569 | // Type |
570 | 570 | print '<td>'; |
571 | - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
571 | + if (!empty($obj->payment_code)) { |
|
572 | + print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
573 | + } |
|
572 | 574 | print '</td>'; |
573 | 575 | if (!$i) { |
574 | 576 | $totalarray['nbfield']++; |
@@ -621,7 +623,9 @@ discard block |
||
621 | 623 | $totalarray['val']['totalttcfield'] += $obj->amount; |
622 | 624 | |
623 | 625 | print '<td class="nowrap right">'.$salstatic->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>'; |
624 | - if (!$i) $totalarray['nbfield']++; |
|
626 | + if (!$i) { |
|
627 | + $totalarray['nbfield']++; |
|
628 | + } |
|
625 | 629 | |
626 | 630 | // Extra fields |
627 | 631 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
@@ -481,7 +481,9 @@ discard block |
||
481 | 481 | // Type |
482 | 482 | if (!empty($arrayfields['t.fk_typepayment']['checked'])) { |
483 | 483 | print '<td>'; |
484 | - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
484 | + if (!empty($obj->payment_code)) { |
|
485 | + print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
486 | + } |
|
485 | 487 | print '</td>'; |
486 | 488 | if (!$i) { |
487 | 489 | $totalarray['nbfield']++; |
@@ -508,7 +510,9 @@ discard block |
||
508 | 510 | print $bankstatic->getNomUrl(1); |
509 | 511 | } |
510 | 512 | print '</td>'; |
511 | - if (!$i) $totalarray['nbfield']++; |
|
513 | + if (!$i) { |
|
514 | + $totalarray['nbfield']++; |
|
515 | + } |
|
512 | 516 | } |
513 | 517 | |
514 | 518 | // Amount |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | llxHeader('', $langs->trans("VATDeclarations")); |
144 | 144 | |
145 | 145 | $sql = 'SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment as type, t.fk_account,'; |
146 | -$sql.= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,'; |
|
147 | -$sql.= ' t.num_payment, pst.code as payment_code,'; |
|
146 | +$sql .= ' ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,'; |
|
147 | +$sql .= ' t.num_payment, pst.code as payment_code,'; |
|
148 | 148 | $sql .= ' SUM(ptva.amount) as alreadypayed'; |
149 | 149 | $sql .= ' FROM '.MAIN_DB_PREFIX.'tva as t'; |
150 | 150 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pst ON (t.fk_typepayment = pst.id)'; |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | // Amount |
510 | 510 | if (!empty($arrayfields['t.amount']['checked'])) { |
511 | 511 | $total = $total + $obj->amount; |
512 | - print '<td class="nowrap right"><span class="amount">' . price($obj->amount) . '</span></td>'; |
|
512 | + print '<td class="nowrap right"><span class="amount">'.price($obj->amount).'</span></td>'; |
|
513 | 513 | if (!$i) { |
514 | 514 | $totalarray['nbfield']++; |
515 | 515 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | |
520 | 520 | if (!empty($arrayfields['t.status']['checked'])) { |
521 | - print '<td class="nowrap right">' . $tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed) . '</td>'; |
|
521 | + print '<td class="nowrap right">'.$tva_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>'; |
|
522 | 522 | if (!$i) { |
523 | 523 | $totalarray['nbfield']++; |
524 | 524 | } |
@@ -95,7 +95,9 @@ discard block |
||
95 | 95 | $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag='".$db->escape($tag)."'"; |
96 | 96 | |
97 | 97 | $resql = $db->query($sql); |
98 | - if (!$resql) dol_print_error($db); |
|
98 | + if (!$resql) { |
|
99 | + dol_print_error($db); |
|
100 | + } |
|
99 | 101 | |
100 | 102 | $obj = $db->fetch_object($resql); |
101 | 103 | |
@@ -124,7 +126,9 @@ discard block |
||
124 | 126 | $statut = '2'; |
125 | 127 | $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".((int) $statut)." WHERE rowid = ".((int) $obj->rowid); |
126 | 128 | $resql = $db->query($sql); |
127 | - if (!$resql) dol_print_error($db); |
|
129 | + if (!$resql) { |
|
130 | + dol_print_error($db); |
|
131 | + } |
|
128 | 132 | |
129 | 133 | //Update status communication of thirdparty prospect |
130 | 134 | if ($obj->source_id > 0 && $obj->source_type == 'thirdparty' && $obj->entity) { |
@@ -245,7 +245,7 @@ |
||
245 | 245 | $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); |
246 | 246 | if (!empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME)) { |
247 | 247 | $newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp; |
248 | - $newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax) |
|
248 | + $newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax) |
|
249 | 249 | } |
250 | 250 | if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { |
251 | 251 | $format = $conf->global->MAIN_DOC_USE_TIMING; |
@@ -92,7 +92,7 @@ |
||
92 | 92 | /** |
93 | 93 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
94 | 94 | */ |
95 | - public $fields=array( |
|
95 | + public $fields = array( |
|
96 | 96 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>0,), |
97 | 97 | 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-2, 'default'=>'1', 'index'=>1,), |
98 | 98 | 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>-1,), |
@@ -177,8 +177,12 @@ discard block |
||
177 | 177 | |
178 | 178 | $this->db = $db; |
179 | 179 | |
180 | - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; |
|
181 | - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; |
|
180 | + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { |
|
181 | + $this->fields['rowid']['visible'] = 0; |
|
182 | + } |
|
183 | + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) { |
|
184 | + $this->fields['entity']['enabled'] = 0; |
|
185 | + } |
|
182 | 186 | |
183 | 187 | // Unset fields that are disabled |
184 | 188 | foreach ($this->fields as $key => $val) { |
@@ -220,7 +224,9 @@ discard block |
||
220 | 224 | |
221 | 225 | // Load source object |
222 | 226 | $result = $object->fetchCommon($fromid); |
223 | - if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); |
|
227 | + if ($result > 0 && !empty($object->table_element_line)) { |
|
228 | + $object->fetchLines(); |
|
229 | + } |
|
224 | 230 | |
225 | 231 | // get lines so they will be clone |
226 | 232 | //foreach($this->lines as $line) |
@@ -232,8 +238,12 @@ discard block |
||
232 | 238 | unset($object->import_key); |
233 | 239 | |
234 | 240 | // Clear fields |
235 | - if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
236 | - if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
241 | + if (property_exists($object, 'ref')) { |
|
242 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
243 | + } |
|
244 | + if (property_exists($object, 'label')) { |
|
245 | + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
246 | + } |
|
237 | 247 | if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; } |
238 | 248 | if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); } |
239 | 249 | if (property_exists($object, 'date_modification')) { $object->date_modification = null; } |
@@ -269,8 +279,9 @@ discard block |
||
269 | 279 | if (!$error) { |
270 | 280 | // copy external contacts if same company |
271 | 281 | if (property_exists($this, 'socid') && $this->socid == $object->socid) { |
272 | - if ($this->copy_linked_contact($object, 'external') < 0) |
|
273 | - $error++; |
|
282 | + if ($this->copy_linked_contact($object, 'external') < 0) { |
|
283 | + $error++; |
|
284 | + } |
|
274 | 285 | } |
275 | 286 | } |
276 | 287 | |
@@ -319,8 +330,11 @@ discard block |
||
319 | 330 | $sql = "SELECT "; |
320 | 331 | $sql .= $this->getFieldList(); |
321 | 332 | $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; |
322 | - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")"; |
|
323 | - else $sql .= " WHERE 1 = 1"; |
|
333 | + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
|
334 | + $sql .= " WHERE t.entity IN (".getEntity($this->element).")"; |
|
335 | + } else { |
|
336 | + $sql .= " WHERE 1 = 1"; |
|
337 | + } |
|
324 | 338 | // Manage filter |
325 | 339 | $sqlwhere = array(); |
326 | 340 | if (count($filter) > 0) { |
@@ -436,8 +450,12 @@ discard block |
||
436 | 450 | $sql = "UPDATE ".$this->db->prefix().$this->table_element; |
437 | 451 | $sql .= " SET ref = '".$this->db->escape($num)."',"; |
438 | 452 | $sql .= " status = ".self::STATUS_VALIDATED; |
439 | - if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
440 | - if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id; |
|
453 | + if (!empty($this->fields['date_validation'])) { |
|
454 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
455 | + } |
|
456 | + if (!empty($this->fields['fk_user_valid'])) { |
|
457 | + $sql .= ", fk_user_valid = ".$user->id; |
|
458 | + } |
|
441 | 459 | $sql .= " WHERE rowid = ".((int) $this->id); |
442 | 460 | |
443 | 461 | dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
@@ -451,7 +469,9 @@ discard block |
||
451 | 469 | if (!$error && !$notrigger) { |
452 | 470 | // Call trigger |
453 | 471 | $result = $this->call_trigger('PRODUCTFOURNISSEURPRICE_VALIDATE', $user); |
454 | - if ($result < 0) $error++; |
|
472 | + if ($result < 0) { |
|
473 | + $error++; |
|
474 | + } |
|
455 | 475 | // End call triggers |
456 | 476 | } |
457 | 477 | } |
@@ -572,7 +592,10 @@ discard block |
||
572 | 592 | { |
573 | 593 | global $conf, $langs, $hookmanager; |
574 | 594 | |
575 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
595 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
596 | + $notooltip = 1; |
|
597 | + } |
|
598 | + // Force disable tooltips |
|
576 | 599 | |
577 | 600 | $result = ''; |
578 | 601 | |
@@ -588,8 +611,12 @@ discard block |
||
588 | 611 | if ($option != 'nolink') { |
589 | 612 | // Add param to save lastsearch_values or not |
590 | 613 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
591 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
592 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
614 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
615 | + $add_save_lastsearch_values = 1; |
|
616 | + } |
|
617 | + if ($add_save_lastsearch_values) { |
|
618 | + $url .= '&save_lastsearch_values=1'; |
|
619 | + } |
|
593 | 620 | } |
594 | 621 | |
595 | 622 | $linkclose = ''; |
@@ -600,7 +627,9 @@ discard block |
||
600 | 627 | } |
601 | 628 | $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
602 | 629 | $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
603 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
630 | + } else { |
|
631 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
632 | + } |
|
604 | 633 | |
605 | 634 | $linkstart = '<a href="'.$url.'"'; |
606 | 635 | $linkstart .= $linkclose.'>'; |
@@ -609,7 +638,9 @@ discard block |
||
609 | 638 | $result .= $linkstart; |
610 | 639 | |
611 | 640 | if (empty($this->showphoto_on_popup)) { |
612 | - if ($withpicto) $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); |
|
641 | + if ($withpicto) { |
|
642 | + $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); |
|
643 | + } |
|
613 | 644 | } else { |
614 | 645 | if ($withpicto) { |
615 | 646 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -635,7 +666,9 @@ discard block |
||
635 | 666 | } |
636 | 667 | } |
637 | 668 | |
638 | - if ($withpicto != 2) $result .= $this->ref; |
|
669 | + if ($withpicto != 2) { |
|
670 | + $result .= $this->ref; |
|
671 | + } |
|
639 | 672 | |
640 | 673 | $result .= $linkend; |
641 | 674 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
@@ -644,8 +677,11 @@ discard block |
||
644 | 677 | $hookmanager->initHooks(array('productfournisseurpricedao')); |
645 | 678 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
646 | 679 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
647 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
648 | - else $result .= $hookmanager->resPrint; |
|
680 | + if ($reshook > 0) { |
|
681 | + $result = $hookmanager->resPrint; |
|
682 | + } else { |
|
683 | + $result .= $hookmanager->resPrint; |
|
684 | + } |
|
649 | 685 | |
650 | 686 | return $result; |
651 | 687 | } |
@@ -685,7 +721,9 @@ discard block |
||
685 | 721 | |
686 | 722 | $statusType = 'status'.$status; |
687 | 723 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
688 | - if ($status == self::STATUS_CANCELED) $statusType = 'status6'; |
|
724 | + if ($status == self::STATUS_CANCELED) { |
|
725 | + $statusType = 'status6'; |
|
726 | + } |
|
689 | 727 | |
690 | 728 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
691 | 729 | } |