@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | * |
| 477 | 477 | * Note: cond_reglement can not be aliased to cond_reglement!!! |
| 478 | 478 | */ |
| 479 | - private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 479 | + private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 480 | 480 | /** |
| 481 | 481 | * @var int|string Internal to detect deprecated access |
| 482 | 482 | */ |
| 483 | - protected $depr_cond_reglement; // Internal value for deprecation |
|
| 483 | + protected $depr_cond_reglement; // Internal value for deprecation |
|
| 484 | 484 | |
| 485 | 485 | /** |
| 486 | 486 | * @var int Delivery address ID |
@@ -537,12 +537,12 @@ discard block |
||
| 537 | 537 | /** |
| 538 | 538 | * @var float|string Multicurrency total localtax1 |
| 539 | 539 | */ |
| 540 | - public $multicurrency_total_localtax1; // not in database |
|
| 540 | + public $multicurrency_total_localtax1; // not in database |
|
| 541 | 541 | |
| 542 | 542 | /** |
| 543 | 543 | * @var float|string Multicurrency total localtax2 |
| 544 | 544 | */ |
| 545 | - public $multicurrency_total_localtax2; // not in database |
|
| 545 | + public $multicurrency_total_localtax2; // not in database |
|
| 546 | 546 | |
| 547 | 547 | /** |
| 548 | 548 | * @var ?string |
@@ -1033,17 +1033,17 @@ discard block |
||
| 1033 | 1033 | } |
| 1034 | 1034 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 1035 | 1035 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 1036 | - $data[$key] = '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 1036 | + $data[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 1037 | 1037 | } else { |
| 1038 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 1039 | - $data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 1038 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 1039 | + $data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 1040 | 1040 | $count++; |
| 1041 | 1041 | } |
| 1042 | 1042 | } |
| 1043 | 1043 | $data['closedivextra'] = '</div>'; |
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1046 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1047 | 1047 | $parameters = array( |
| 1048 | 1048 | 'tooltipcontentarray' => &$data, |
| 1049 | 1049 | 'params' => $params, |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | $sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")"; |
| 1546 | 1546 | } |
| 1547 | 1547 | if ($status >= 0) { |
| 1548 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1548 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1549 | 1549 | } |
| 1550 | 1550 | if ($statusoflink >= 0) { |
| 1551 | 1551 | $sql .= " AND ec.statut = ".((int) $statusoflink); |
@@ -1934,7 +1934,7 @@ discard block |
||
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | 1936 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; |
| 1937 | - $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1937 | + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1938 | 1938 | $sql .= " LIMIT 1"; |
| 1939 | 1939 | |
| 1940 | 1940 | $query = $this->db->query($sql); |
@@ -2253,9 +2253,9 @@ discard block |
||
| 2253 | 2253 | |
| 2254 | 2254 | $oldvalue = null; |
| 2255 | 2255 | if ($trigkey) { |
| 2256 | - $sql = "SELECT " . $field; |
|
| 2257 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2258 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2256 | + $sql = "SELECT ".$field; |
|
| 2257 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2258 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2259 | 2259 | |
| 2260 | 2260 | $resql = $this->db->query($sql); |
| 2261 | 2261 | if ($resql) { |
@@ -2635,7 +2635,7 @@ discard block |
||
| 2635 | 2635 | // Triggers |
| 2636 | 2636 | if (!$error && !$notrigger) { |
| 2637 | 2637 | // Call triggers |
| 2638 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2638 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2639 | 2639 | if ($result < 0) { |
| 2640 | 2640 | $error++; |
| 2641 | 2641 | } //Do also here what you must do to rollback action if trigger fail |
@@ -3014,7 +3014,7 @@ discard block |
||
| 3014 | 3014 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 3015 | 3015 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 3016 | 3016 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 3017 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'"); |
|
| 3017 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'"); |
|
| 3018 | 3018 | } |
| 3019 | 3019 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 3020 | 3020 | |
@@ -3362,10 +3362,10 @@ discard block |
||
| 3362 | 3362 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3363 | 3363 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3364 | 3364 | if (!$renum) { |
| 3365 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3365 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3366 | 3366 | } |
| 3367 | 3367 | if ($renum) { |
| 3368 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3368 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3369 | 3369 | } |
| 3370 | 3370 | |
| 3371 | 3371 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3386,7 +3386,7 @@ discard block |
||
| 3386 | 3386 | if ($fk_parent_line) { |
| 3387 | 3387 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3388 | 3388 | } |
| 3389 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3389 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3390 | 3390 | |
| 3391 | 3391 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3392 | 3392 | $resql = $this->db->query($sql); |
@@ -3438,7 +3438,7 @@ discard block |
||
| 3438 | 3438 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3439 | 3439 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3440 | 3440 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3441 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3441 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3442 | 3442 | |
| 3443 | 3443 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3444 | 3444 | |
@@ -3562,7 +3562,7 @@ discard block |
||
| 3562 | 3562 | |
| 3563 | 3563 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3564 | 3564 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3565 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3565 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3566 | 3566 | if ($this->db->query($sql)) { |
| 3567 | 3567 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3568 | 3568 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3593,7 +3593,7 @@ discard block |
||
| 3593 | 3593 | |
| 3594 | 3594 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3595 | 3595 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3596 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3596 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3597 | 3597 | if ($this->db->query($sql)) { |
| 3598 | 3598 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3599 | 3599 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3619,7 +3619,7 @@ discard block |
||
| 3619 | 3619 | $fieldposition = 'position'; |
| 3620 | 3620 | } |
| 3621 | 3621 | |
| 3622 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3622 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3623 | 3623 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3624 | 3624 | |
| 3625 | 3625 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3647,7 +3647,7 @@ discard block |
||
| 3647 | 3647 | |
| 3648 | 3648 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3649 | 3649 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3650 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3650 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3651 | 3651 | $resql = $this->db->query($sql); |
| 3652 | 3652 | if ($resql) { |
| 3653 | 3653 | $row = $this->db->fetch_row($resql); |
@@ -3766,7 +3766,7 @@ discard block |
||
| 3766 | 3766 | $newsuffix = ''; |
| 3767 | 3767 | } |
| 3768 | 3768 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3769 | - $fieldusermod = "fk_user_mod"; |
|
| 3769 | + $fieldusermod = "fk_user_mod"; |
|
| 3770 | 3770 | } elseif ($this->table_element == 'ecm_files') { |
| 3771 | 3771 | $fieldusermod = "fk_user_m"; |
| 3772 | 3772 | } else { |
@@ -3808,7 +3808,7 @@ discard block |
||
| 3808 | 3808 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3809 | 3809 | break; |
| 3810 | 3810 | default: |
| 3811 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3811 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3812 | 3812 | } |
| 3813 | 3813 | $ret = $this->call_trigger($trigger_name, $user); |
| 3814 | 3814 | if ($ret < 0) { |
@@ -4106,7 +4106,7 @@ discard block |
||
| 4106 | 4106 | // Situations totals |
| 4107 | 4107 | if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { // @phan-suppress-current-line PhanUndeclaredProperty |
| 4108 | 4108 | '@phan-var-force Facture $this'; |
| 4109 | - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded |
|
| 4109 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded |
|
| 4110 | 4110 | if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line |
| 4111 | 4111 | if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) { |
| 4112 | 4112 | $prev_sits = $this->get_prev_sits(); |
@@ -4232,19 +4232,19 @@ discard block |
||
| 4232 | 4232 | $this->db->begin(); |
| 4233 | 4233 | $error = 0; |
| 4234 | 4234 | |
| 4235 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 4235 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 4236 | 4236 | $sql .= "fk_source"; |
| 4237 | 4237 | $sql .= ", sourcetype"; |
| 4238 | 4238 | $sql .= ", fk_target"; |
| 4239 | 4239 | $sql .= ", targettype"; |
| 4240 | 4240 | $sql .= ") VALUES ("; |
| 4241 | 4241 | $sql .= ((int) $origin_id); |
| 4242 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 4243 | - $sql .= ", " . ((int) $this->id); |
|
| 4244 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 4242 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 4243 | + $sql .= ", ".((int) $this->id); |
|
| 4244 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 4245 | 4245 | $sql .= ")"; |
| 4246 | 4246 | |
| 4247 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 4247 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 4248 | 4248 | if ($this->db->query($sql)) { |
| 4249 | 4249 | if (!$notrigger) { |
| 4250 | 4250 | // Call trigger |
@@ -4499,20 +4499,20 @@ discard block |
||
| 4499 | 4499 | $this->db->begin(); |
| 4500 | 4500 | $error = 0; |
| 4501 | 4501 | |
| 4502 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4502 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4503 | 4503 | if ($updatesource) { |
| 4504 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4505 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4506 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4507 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4504 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4505 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4506 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4507 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4508 | 4508 | } elseif ($updatetarget) { |
| 4509 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4510 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4511 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4512 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4509 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4510 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4511 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4512 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4513 | 4513 | } |
| 4514 | 4514 | |
| 4515 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4515 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4516 | 4516 | if ($this->db->query($sql)) { |
| 4517 | 4517 | if (!$notrigger) { |
| 4518 | 4518 | // Call trigger |
@@ -4589,25 +4589,25 @@ discard block |
||
| 4589 | 4589 | } |
| 4590 | 4590 | |
| 4591 | 4591 | if (!$error) { |
| 4592 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4592 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4593 | 4593 | $sql .= " WHERE"; |
| 4594 | 4594 | if ($rowid > 0) { |
| 4595 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4595 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4596 | 4596 | } else { |
| 4597 | 4597 | if ($deletesource) { |
| 4598 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4599 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'"; |
|
| 4598 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4599 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'"; |
|
| 4600 | 4600 | } elseif ($deletetarget) { |
| 4601 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4602 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'"; |
|
| 4601 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4602 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'"; |
|
| 4603 | 4603 | } else { |
| 4604 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')"; |
|
| 4604 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')"; |
|
| 4605 | 4605 | $sql .= " OR"; |
| 4606 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')"; |
|
| 4606 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')"; |
|
| 4607 | 4607 | } |
| 4608 | 4608 | } |
| 4609 | 4609 | |
| 4610 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4610 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4611 | 4611 | if (!$this->db->query($sql)) { |
| 4612 | 4612 | $this->error = $this->db->lasterror(); |
| 4613 | 4613 | $this->errors[] = $this->error; |
@@ -4772,14 +4772,14 @@ discard block |
||
| 4772 | 4772 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4773 | 4773 | } |
| 4774 | 4774 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4775 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4775 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4776 | 4776 | |
| 4777 | 4777 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4778 | 4778 | $resql = $this->db->query($sql); |
| 4779 | 4779 | if ($resql) { |
| 4780 | 4780 | $error = 0; |
| 4781 | 4781 | |
| 4782 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4782 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4783 | 4783 | |
| 4784 | 4784 | if ($nb_rows_affected > 0) { |
| 4785 | 4785 | if (empty($trigkey)) { |
@@ -4826,7 +4826,7 @@ discard block |
||
| 4826 | 4826 | if ($fieldstatus == 'tosell') { |
| 4827 | 4827 | $this->status = $status; |
| 4828 | 4828 | } elseif ($fieldstatus == 'tobuy') { |
| 4829 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4829 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4830 | 4830 | } else { |
| 4831 | 4831 | $this->status = $status; |
| 4832 | 4832 | } |
@@ -4934,7 +4934,7 @@ discard block |
||
| 4934 | 4934 | return -1; |
| 4935 | 4935 | } |
| 4936 | 4936 | |
| 4937 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4937 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4938 | 4938 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4939 | 4939 | $tmparray = array_keys($this->childtables); |
| 4940 | 4940 | if (is_numeric($tmparray[0])) { |
@@ -6051,7 +6051,7 @@ discard block |
||
| 6051 | 6051 | $setsharekey = false; |
| 6052 | 6052 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 6053 | 6053 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 6054 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6054 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6055 | 6055 | } |
| 6056 | 6056 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 6057 | 6057 | $setsharekey = true; |
@@ -6111,7 +6111,7 @@ discard block |
||
| 6111 | 6111 | $ecmfile->gen_or_uploaded = 'generated'; |
| 6112 | 6112 | $ecmfile->description = ''; // indexed content |
| 6113 | 6113 | $ecmfile->keywords = ''; // keyword content |
| 6114 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6114 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6115 | 6115 | $ecmfile->src_object_id = $this->id; |
| 6116 | 6116 | |
| 6117 | 6117 | $result = $ecmfile->create($user); |
@@ -6263,8 +6263,8 @@ discard block |
||
| 6263 | 6263 | // phpcs:enable |
| 6264 | 6264 | global $langs, $conf; |
| 6265 | 6265 | |
| 6266 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 6267 | - dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 6266 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 6267 | + dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 6268 | 6268 | exit; |
| 6269 | 6269 | } |
| 6270 | 6270 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6456,7 +6456,7 @@ discard block |
||
| 6456 | 6456 | $savDisableCompute = $conf->disable_compute; |
| 6457 | 6457 | $conf->disable_compute = 1; |
| 6458 | 6458 | |
| 6459 | - $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6459 | + $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6460 | 6460 | |
| 6461 | 6461 | $conf->disable_compute = $savDisableCompute; |
| 6462 | 6462 | |
@@ -6518,7 +6518,7 @@ discard block |
||
| 6518 | 6518 | if (is_array($optionsArray) && count($optionsArray) > 0) { |
| 6519 | 6519 | $sql = "SELECT rowid"; |
| 6520 | 6520 | foreach ($optionsArray as $name => $label) { |
| 6521 | - if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) { |
|
| 6521 | + if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) { |
|
| 6522 | 6522 | $sql .= ", ".$name; |
| 6523 | 6523 | } |
| 6524 | 6524 | // use geo sql fonction to read as text |
@@ -6571,7 +6571,7 @@ discard block |
||
| 6571 | 6571 | **/ |
| 6572 | 6572 | if (is_array($extrafields->attributes[$this->table_element]['label'])) { |
| 6573 | 6573 | foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { |
| 6574 | - $this->array_options['options_' . $key] = null; |
|
| 6574 | + $this->array_options['options_'.$key] = null; |
|
| 6575 | 6575 | } |
| 6576 | 6576 | } |
| 6577 | 6577 | } |
@@ -6583,9 +6583,9 @@ discard block |
||
| 6583 | 6583 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6584 | 6584 | //var_dump($conf->disable_compute); |
| 6585 | 6585 | if (empty($conf->disable_compute)) { |
| 6586 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6587 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6588 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6586 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6587 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6588 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6589 | 6589 | } |
| 6590 | 6590 | } |
| 6591 | 6591 | } |
@@ -6770,7 +6770,7 @@ discard block |
||
| 6770 | 6770 | // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 6771 | 6771 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6772 | 6772 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6773 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6773 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6774 | 6774 | } else { |
| 6775 | 6775 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6776 | 6776 | } |
@@ -6781,7 +6781,7 @@ discard block |
||
| 6781 | 6781 | // If value has changed |
| 6782 | 6782 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6783 | 6783 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6784 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6784 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6785 | 6785 | } else { |
| 6786 | 6786 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6787 | 6787 | } |
@@ -6793,7 +6793,7 @@ discard block |
||
| 6793 | 6793 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6794 | 6794 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6795 | 6795 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6796 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6796 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6797 | 6797 | } else { |
| 6798 | 6798 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6799 | 6799 | } |
@@ -7243,7 +7243,7 @@ discard block |
||
| 7243 | 7243 | if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) { // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 7244 | 7244 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 7245 | 7245 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 7246 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7246 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7247 | 7247 | } else { |
| 7248 | 7248 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7249 | 7249 | } |
@@ -7263,7 +7263,7 @@ discard block |
||
| 7263 | 7263 | } |
| 7264 | 7264 | } else { |
| 7265 | 7265 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 7266 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7266 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7267 | 7267 | } else { |
| 7268 | 7268 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7269 | 7269 | } |
@@ -7850,7 +7850,7 @@ discard block |
||
| 7850 | 7850 | // 7 : sort field |
| 7851 | 7851 | |
| 7852 | 7852 | // If there is filter |
| 7853 | - if (! empty($InfoFieldList[4])) { |
|
| 7853 | + if (!empty($InfoFieldList[4])) { |
|
| 7854 | 7854 | $pos = 0; |
| 7855 | 7855 | $parenthesisopen = 0; |
| 7856 | 7856 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -7914,8 +7914,8 @@ discard block |
||
| 7914 | 7914 | } |
| 7915 | 7915 | |
| 7916 | 7916 | $sqlwhere = ''; |
| 7917 | - $sql = "SELECT " . $keyList; |
|
| 7918 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7917 | + $sql = "SELECT ".$keyList; |
|
| 7918 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7919 | 7919 | |
| 7920 | 7920 | if (!empty($InfoFieldList[4])) { |
| 7921 | 7921 | // can use SELECT request |
@@ -7933,11 +7933,11 @@ discard block |
||
| 7933 | 7933 | // We have to join on extrafield table |
| 7934 | 7934 | $errstr = ''; |
| 7935 | 7935 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7936 | - $sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra"; |
|
| 7937 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 7938 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7936 | + $sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra"; |
|
| 7937 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 7938 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7939 | 7939 | } else { |
| 7940 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7940 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7941 | 7941 | } |
| 7942 | 7942 | } else { |
| 7943 | 7943 | $sqlwhere .= ' WHERE 1=1'; |
@@ -7958,7 +7958,7 @@ discard block |
||
| 7958 | 7958 | |
| 7959 | 7959 | // Some tables may have field, some other not. For the moment we disable it. |
| 7960 | 7960 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7961 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7961 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7962 | 7962 | } |
| 7963 | 7963 | $sql .= $sqlwhere; |
| 7964 | 7964 | |
@@ -7968,10 +7968,10 @@ discard block |
||
| 7968 | 7968 | } else { |
| 7969 | 7969 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7970 | 7970 | } |
| 7971 | - $sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000); |
|
| 7971 | + $sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000); |
|
| 7972 | 7972 | // print $sql; |
| 7973 | 7973 | |
| 7974 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7974 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7975 | 7975 | $resql = $this->db->query($sql); |
| 7976 | 7976 | if ($resql) { |
| 7977 | 7977 | $out .= '<option value="0"> </option>'; |
@@ -7987,7 +7987,7 @@ discard block |
||
| 7987 | 7987 | if (count($fields_label) > 1) { |
| 7988 | 7988 | $notrans = true; |
| 7989 | 7989 | foreach ($fields_label as $field_toshow) { |
| 7990 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7990 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7991 | 7991 | } |
| 7992 | 7992 | } else { |
| 7993 | 7993 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7998,12 +7998,12 @@ discard block |
||
| 7998 | 7998 | foreach ($fields_label as $field_toshow) { |
| 7999 | 7999 | $translabel = $langs->trans($obj->$field_toshow); |
| 8000 | 8000 | if ($translabel != $obj->$field_toshow) { |
| 8001 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 8001 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 8002 | 8002 | } else { |
| 8003 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 8003 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 8004 | 8004 | } |
| 8005 | 8005 | } |
| 8006 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 8006 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 8007 | 8007 | } else { |
| 8008 | 8008 | if (!$notrans) { |
| 8009 | 8009 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -8017,25 +8017,25 @@ discard block |
||
| 8017 | 8017 | $labeltoshow = '(not defined)'; |
| 8018 | 8018 | } |
| 8019 | 8019 | if ($value == $obj->rowid) { |
| 8020 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 8020 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 8021 | 8021 | } |
| 8022 | 8022 | |
| 8023 | 8023 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 8024 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 8024 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 8025 | 8025 | $isDependList = 1; |
| 8026 | 8026 | } |
| 8027 | 8027 | |
| 8028 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 8028 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 8029 | 8029 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 8030 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 8031 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 8030 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 8031 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 8032 | 8032 | } |
| 8033 | 8033 | |
| 8034 | 8034 | $i++; |
| 8035 | 8035 | } |
| 8036 | 8036 | $this->db->free($resql); |
| 8037 | 8037 | } else { |
| 8038 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 8038 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 8039 | 8039 | } |
| 8040 | 8040 | } else { |
| 8041 | 8041 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
@@ -8046,9 +8046,9 @@ discard block |
||
| 8046 | 8046 | $data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 8047 | 8047 | $out .= '<option value="0"> </option>'; |
| 8048 | 8048 | foreach ($data as $data_key => $data_value) { |
| 8049 | - $out .= '<option value="' . $data_key . '"'; |
|
| 8049 | + $out .= '<option value="'.$data_key.'"'; |
|
| 8050 | 8050 | $out .= ($value == $data_key ? ' selected' : ''); |
| 8051 | - $out .= '>' . $data_value . '</option>'; |
|
| 8051 | + $out .= '>'.$data_value.'</option>'; |
|
| 8052 | 8052 | } |
| 8053 | 8053 | } |
| 8054 | 8054 | } |
@@ -8088,7 +8088,7 @@ discard block |
||
| 8088 | 8088 | // 7 : sort field |
| 8089 | 8089 | |
| 8090 | 8090 | // If there is a filter |
| 8091 | - if (! empty($InfoFieldList[4])) { |
|
| 8091 | + if (!empty($InfoFieldList[4])) { |
|
| 8092 | 8092 | $pos = 0; |
| 8093 | 8093 | $parenthesisopen = 0; |
| 8094 | 8094 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -8154,8 +8154,8 @@ discard block |
||
| 8154 | 8154 | } |
| 8155 | 8155 | |
| 8156 | 8156 | $sqlwhere = ''; |
| 8157 | - $sql = "SELECT " . $keyList; |
|
| 8158 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 8157 | + $sql = "SELECT ".$keyList; |
|
| 8158 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 8159 | 8159 | |
| 8160 | 8160 | if (!empty($InfoFieldList[4])) { |
| 8161 | 8161 | // can use SELECT request |
@@ -8173,11 +8173,11 @@ discard block |
||
| 8173 | 8173 | // We have to join on extrafield table |
| 8174 | 8174 | $errstr = ''; |
| 8175 | 8175 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 8176 | - $sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra'; |
|
| 8177 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 8178 | - $sqlwhere .= " AND " . $InfoFieldList[4]; |
|
| 8176 | + $sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra'; |
|
| 8177 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 8178 | + $sqlwhere .= " AND ".$InfoFieldList[4]; |
|
| 8179 | 8179 | } else { |
| 8180 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 8180 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 8181 | 8181 | } |
| 8182 | 8182 | } else { |
| 8183 | 8183 | $sqlwhere .= ' WHERE 1=1'; |
@@ -8198,14 +8198,14 @@ discard block |
||
| 8198 | 8198 | |
| 8199 | 8199 | // Some tables may have field, some other not. For the moment we disable it. |
| 8200 | 8200 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 8201 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 8201 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 8202 | 8202 | } |
| 8203 | 8203 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 8204 | 8204 | // print $sql; |
| 8205 | 8205 | |
| 8206 | 8206 | $sql .= $sqlwhere; |
| 8207 | 8207 | |
| 8208 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8208 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8209 | 8209 | |
| 8210 | 8210 | $resql = $this->db->query($sql); |
| 8211 | 8211 | if ($resql) { |
@@ -8224,7 +8224,7 @@ discard block |
||
| 8224 | 8224 | if (count($fields_label) > 1) { |
| 8225 | 8225 | $notrans = true; |
| 8226 | 8226 | foreach ($fields_label as $field_toshow) { |
| 8227 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 8227 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 8228 | 8228 | } |
| 8229 | 8229 | } else { |
| 8230 | 8230 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -8235,9 +8235,9 @@ discard block |
||
| 8235 | 8235 | foreach ($fields_label as $field_toshow) { |
| 8236 | 8236 | $translabel = $langs->trans($obj->$field_toshow); |
| 8237 | 8237 | if ($translabel != $obj->$field_toshow) { |
| 8238 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 8238 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 8239 | 8239 | } else { |
| 8240 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 8240 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 8241 | 8241 | } |
| 8242 | 8242 | } |
| 8243 | 8243 | |
@@ -8260,7 +8260,7 @@ discard block |
||
| 8260 | 8260 | } |
| 8261 | 8261 | |
| 8262 | 8262 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 8263 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 8263 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 8264 | 8264 | $isDependList = 1; |
| 8265 | 8265 | } |
| 8266 | 8266 | |
@@ -8271,9 +8271,9 @@ discard block |
||
| 8271 | 8271 | } |
| 8272 | 8272 | $this->db->free($resql); |
| 8273 | 8273 | |
| 8274 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8274 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8275 | 8275 | } else { |
| 8276 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 8276 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 8277 | 8277 | } |
| 8278 | 8278 | } else { |
| 8279 | 8279 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
@@ -8282,7 +8282,7 @@ discard block |
||
| 8282 | 8282 | $categcode = Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]]; |
| 8283 | 8283 | } |
| 8284 | 8284 | $data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 8285 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8285 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8286 | 8286 | } |
| 8287 | 8287 | } |
| 8288 | 8288 | } elseif ($type == 'link') { |
@@ -8317,7 +8317,7 @@ discard block |
||
| 8317 | 8317 | // $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller. |
| 8318 | 8318 | |
| 8319 | 8319 | //$objectfield = $valparent; |
| 8320 | - $objectfield = $val; // Is better than using old method $valparent |
|
| 8320 | + $objectfield = $val; // Is better than using old method $valparent |
|
| 8321 | 8321 | |
| 8322 | 8322 | // @phan-suppress-next-line PhanTypeMismatchArgumentNullable |
| 8323 | 8323 | $out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield); |
@@ -8530,7 +8530,7 @@ discard block |
||
| 8530 | 8530 | $value = $this->getLibStatut(3); |
| 8531 | 8531 | } elseif ($type == 'date') { |
| 8532 | 8532 | if (!empty($value)) { |
| 8533 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8533 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8534 | 8534 | } else { |
| 8535 | 8535 | $value = ''; |
| 8536 | 8536 | } |
@@ -8631,7 +8631,7 @@ discard block |
||
| 8631 | 8631 | $value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : ''; |
| 8632 | 8632 | if (strpos($value, "|") !== false) { |
| 8633 | 8633 | $value = $langs->trans(explode('|', $value)[0]); |
| 8634 | - } elseif (! is_numeric($value)) { |
|
| 8634 | + } elseif (!is_numeric($value)) { |
|
| 8635 | 8635 | $value = $langs->trans($value); |
| 8636 | 8636 | } |
| 8637 | 8637 | } elseif ($type == 'sellist') { |
@@ -8693,9 +8693,9 @@ discard block |
||
| 8693 | 8693 | $translabel = $langs->trans($obj->$field_toshow); |
| 8694 | 8694 | } |
| 8695 | 8695 | if ($translabel != $field_toshow) { |
| 8696 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 8696 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 8697 | 8697 | } else { |
| 8698 | - $value .= $obj->$field_toshow . ' '; |
|
| 8698 | + $value .= $obj->$field_toshow.' '; |
|
| 8699 | 8699 | } |
| 8700 | 8700 | } |
| 8701 | 8701 | } else { |
@@ -8711,7 +8711,7 @@ discard block |
||
| 8711 | 8711 | } |
| 8712 | 8712 | } |
| 8713 | 8713 | } else { |
| 8714 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8714 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8715 | 8715 | |
| 8716 | 8716 | $toprint = array(); |
| 8717 | 8717 | $obj = $this->db->fetch_object($resql); |
@@ -8719,7 +8719,7 @@ discard block |
||
| 8719 | 8719 | $c->fetch($obj->rowid); |
| 8720 | 8720 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8721 | 8721 | foreach ($ways as $way) { |
| 8722 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8722 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8723 | 8723 | } |
| 8724 | 8724 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 8725 | 8725 | } |
@@ -8735,11 +8735,11 @@ discard block |
||
| 8735 | 8735 | $toprint = array(); |
| 8736 | 8736 | foreach ($value_arr as $keyval => $valueval) { |
| 8737 | 8737 | if (!empty($valueval)) { |
| 8738 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 8738 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 8739 | 8739 | } |
| 8740 | 8740 | } |
| 8741 | 8741 | if (!empty($toprint)) { |
| 8742 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 8742 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 8743 | 8743 | } |
| 8744 | 8744 | } |
| 8745 | 8745 | } elseif ($type == 'chkbxlst') { |
@@ -8794,9 +8794,9 @@ discard block |
||
| 8794 | 8794 | $translabel = $langs->trans($obj->$field_toshow); |
| 8795 | 8795 | } |
| 8796 | 8796 | if ($translabel != $field_toshow) { |
| 8797 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8797 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8798 | 8798 | } else { |
| 8799 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8799 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8800 | 8800 | } |
| 8801 | 8801 | } |
| 8802 | 8802 | } else { |
@@ -8805,15 +8805,15 @@ discard block |
||
| 8805 | 8805 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8806 | 8806 | } |
| 8807 | 8807 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8808 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8808 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8809 | 8809 | } else { |
| 8810 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8810 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8811 | 8811 | } |
| 8812 | 8812 | } |
| 8813 | 8813 | } |
| 8814 | 8814 | } |
| 8815 | 8815 | } else { |
| 8816 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8816 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8817 | 8817 | |
| 8818 | 8818 | $toprint = array(); |
| 8819 | 8819 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8822,7 +8822,7 @@ discard block |
||
| 8822 | 8822 | $c->fetch($obj->rowid); |
| 8823 | 8823 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8824 | 8824 | foreach ($ways as $way) { |
| 8825 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8825 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8826 | 8826 | } |
| 8827 | 8827 | } |
| 8828 | 8828 | } |
@@ -8992,7 +8992,7 @@ discard block |
||
| 8992 | 8992 | global $langs; |
| 8993 | 8993 | |
| 8994 | 8994 | if (!class_exists('Validate')) { |
| 8995 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8995 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8996 | 8996 | } |
| 8997 | 8997 | |
| 8998 | 8998 | $this->clearFieldError($fieldKey); |
@@ -9231,7 +9231,7 @@ discard block |
||
| 9231 | 9231 | $out .= "\n"; |
| 9232 | 9232 | |
| 9233 | 9233 | $nbofextrafieldsshown = 0; |
| 9234 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 9234 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 9235 | 9235 | |
| 9236 | 9236 | $lastseparatorkeyfound = ''; |
| 9237 | 9237 | $extrafields_collapse_num = ''; |
@@ -9269,9 +9269,9 @@ discard block |
||
| 9269 | 9269 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
| 9270 | 9270 | } elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) { |
| 9271 | 9271 | // We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost |
| 9272 | - $ef_name = 'options_' . $key; |
|
| 9272 | + $ef_name = 'options_'.$key; |
|
| 9273 | 9273 | $ef_value = $this->array_options[$ef_name]; |
| 9274 | - $out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n"; |
|
| 9274 | + $out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n"; |
|
| 9275 | 9275 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation |
| 9276 | 9276 | } elseif ($mode == 'view' && empty($visibility)) { |
| 9277 | 9277 | continue; |
@@ -10349,7 +10349,7 @@ discard block |
||
| 10349 | 10349 | continue; |
| 10350 | 10350 | } |
| 10351 | 10351 | } |
| 10352 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 10352 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 10353 | 10353 | } |
| 10354 | 10354 | return implode(',', $keys_with_alias); |
| 10355 | 10355 | } else { |
@@ -10490,7 +10490,7 @@ discard block |
||
| 10490 | 10490 | if (!$error) { |
| 10491 | 10491 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 10492 | 10492 | $sql .= " (".implode(", ", $keys).')'; |
| 10493 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10493 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10494 | 10494 | |
| 10495 | 10495 | $res = $this->db->query($sql); |
| 10496 | 10496 | if (!$res) { |
@@ -10802,7 +10802,7 @@ discard block |
||
| 10802 | 10802 | |
| 10803 | 10803 | // Update extrafield |
| 10804 | 10804 | if (!$error) { |
| 10805 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10805 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10806 | 10806 | if ($result < 0) { |
| 10807 | 10807 | $error++; |
| 10808 | 10808 | } |
@@ -11004,12 +11004,12 @@ discard block |
||
| 11004 | 11004 | $error++; |
| 11005 | 11005 | } else { |
| 11006 | 11006 | while ($obj = $this->db->fetch_object($resql)) { |
| 11007 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 11007 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 11008 | 11008 | if ($result < 0) { |
| 11009 | 11009 | $error++; |
| 11010 | 11010 | $this->errors[] = $this->error; |
| 11011 | 11011 | } else { |
| 11012 | - $result = $this->delete($user); // @phpstan-ignore-line |
|
| 11012 | + $result = $this->delete($user); // @phpstan-ignore-line |
|
| 11013 | 11013 | if ($result < 0) { |
| 11014 | 11014 | $error++; |
| 11015 | 11015 | $this->errors[] = $this->error; |
@@ -11175,7 +11175,7 @@ discard block |
||
| 11175 | 11175 | ); |
| 11176 | 11176 | foreach ($fields as $key => $value) { |
| 11177 | 11177 | if (array_key_exists($key, $this->fields)) { |
| 11178 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11178 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11179 | 11179 | } |
| 11180 | 11180 | } |
| 11181 | 11181 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $cancel = GETPOST('cancel', 'alpha'); |
| 66 | 66 | $toselect = GETPOST('toselect', 'array'); |
| 67 | 67 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search |
| 68 | -$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 69 | -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used |
|
| 68 | +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 69 | +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | $id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id')); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | if ($ret < 0) { |
| 109 | 109 | dol_print_error($db, $object->error, $object->errors); |
| 110 | 110 | exit; |
| 111 | - } elseif (! $ret) { |
|
| 111 | + } elseif (!$ret) { |
|
| 112 | 112 | setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
| 257 | 257 | $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); |
| 258 | - $object->fk_societe_rib = GETPOSTINT('accountcustomerid'); |
|
| 258 | + $object->fk_societe_rib = GETPOSTINT('accountcustomerid'); |
|
| 259 | 259 | |
| 260 | 260 | $object->frequency = $frequency; |
| 261 | 261 | $object->unit_frequency = GETPOST('unit_frequency', 'alpha'); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | setEventMessages($line->error, $line->errors, 'errors'); |
| 474 | 474 | } |
| 475 | 475 | } elseif ($action == 'update_extras' && $usercancreate) { |
| 476 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 476 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 477 | 477 | |
| 478 | 478 | // Fill array 'array_options' with data from update form |
| 479 | 479 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | // Define special_code for special lines |
| 853 | 853 | $special_code = GETPOSTINT('special_code'); |
| 854 | 854 | if ($special_code == 3) { |
| 855 | - $special_code = 0; // Options should not exists on invoices |
|
| 855 | + $special_code = 0; // Options should not exists on invoices |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /*$line = new FactureLigne($db); |
@@ -1128,11 +1128,11 @@ discard block |
||
| 1128 | 1128 | |
| 1129 | 1129 | print '<script> |
| 1130 | 1130 | $(document).ready(function() { |
| 1131 | - if($("#selectmode_reglement_id option:selected").data("code") != "' . $factureRec::PAYMENTCODETOEDITSOCIETERIB . '") { |
|
| 1131 | + if($("#selectmode_reglement_id option:selected").data("code") != "' . $factureRec::PAYMENTCODETOEDITSOCIETERIB.'") { |
|
| 1132 | 1132 | hideselectfksocieterib(); |
| 1133 | 1133 | } |
| 1134 | 1134 | $("#selectmode_reglement_id").change(function() { |
| 1135 | - if($("#selectmode_reglement_id option:selected").data("code") != "'. $factureRec::PAYMENTCODETOEDITSOCIETERIB .'") { |
|
| 1135 | + if($("#selectmode_reglement_id option:selected").data("code") != "'. $factureRec::PAYMENTCODETOEDITSOCIETERIB.'") { |
|
| 1136 | 1136 | hideselectfksocieterib(1); |
| 1137 | 1137 | } else { |
| 1138 | 1138 | showselectfksocieterib(); |
@@ -1474,15 +1474,15 @@ discard block |
||
| 1474 | 1474 | print '<td>'; |
| 1475 | 1475 | |
| 1476 | 1476 | if (($action != 'editbankaccountcustomer') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) { |
| 1477 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editbankaccountcustomer&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetDebitBankAccount'), 1) . '</a></td>'; |
|
| 1477 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccountcustomer&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDebitBankAccount'), 1).'</a></td>'; |
|
| 1478 | 1478 | } |
| 1479 | 1479 | print '</tr></table>'; |
| 1480 | 1480 | print '</td><td>'; |
| 1481 | 1481 | |
| 1482 | 1482 | if ($action == 'editbankaccountcustomer') { |
| 1483 | - $form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_societe_rib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, 1); |
|
| 1483 | + $form->formRib($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_societe_rib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, 1); |
|
| 1484 | 1484 | } else { |
| 1485 | - $form->formRib($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_societe_rib, 'none', '', 0, 1); |
|
| 1485 | + $form->formRib($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_societe_rib, 'none', '', 0, 1); |
|
| 1486 | 1486 | } |
| 1487 | 1487 | print "</td>"; |
| 1488 | 1488 | print '</tr>'; |
@@ -1702,10 +1702,10 @@ discard block |
||
| 1702 | 1702 | |
| 1703 | 1703 | // Lines |
| 1704 | 1704 | print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOSTINT('lineid')).'" method="POST">'; |
| 1705 | - print '<input type="hidden" name="token" value="' . newToken().'">'; |
|
| 1706 | - print '<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">'; |
|
| 1705 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 1706 | + print '<input type="hidden" name="action" value="'.(($action != 'editline') ? 'addline' : 'updateline').'">'; |
|
| 1707 | 1707 | print '<input type="hidden" name="mode" value="">'; |
| 1708 | - print '<input type="hidden" name="id" value="' . $object->id.'">'; |
|
| 1708 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 1709 | 1709 | print '<input type="hidden" name="page_y" value="">'; |
| 1710 | 1710 | |
| 1711 | 1711 | if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { |
@@ -1760,16 +1760,16 @@ discard block |
||
| 1760 | 1760 | if (empty($object->suspended)) { |
| 1761 | 1761 | if ($user->hasRight('facture', 'creer')) { |
| 1762 | 1762 | if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { |
| 1763 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
| 1763 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; |
|
| 1764 | 1764 | } else { |
| 1765 | 1765 | if (empty($object->frequency) || $object->date_when <= $nowlasthour) { |
| 1766 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
| 1766 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; |
|
| 1767 | 1767 | } else { |
| 1768 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
| 1768 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; |
|
| 1769 | 1769 | } |
| 1770 | 1770 | } |
| 1771 | 1771 | } else { |
| 1772 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>'; |
|
| 1772 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>'; |
|
| 1773 | 1773 | } |
| 1774 | 1774 | } |
| 1775 | 1775 | |
@@ -1782,7 +1782,7 @@ discard block |
||
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | // Delete |
| 1785 | - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $user->hasRight('facture', 'supprimer')); |
|
| 1785 | + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->hasRight('facture', 'supprimer')); |
|
| 1786 | 1786 | } |
| 1787 | 1787 | print '</div>'; |
| 1788 | 1788 | |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // General $Variables |
| 94 | -$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility |
|
| 94 | +$id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility |
|
| 95 | 95 | $ref = GETPOST('ref', 'alpha'); |
| 96 | 96 | $socid = GETPOSTINT('socid'); |
| 97 | 97 | $action = GETPOST('action', 'aZ09'); |
| 98 | 98 | $confirm = GETPOST('confirm', 'alpha'); |
| 99 | 99 | $cancel = GETPOST('cancel', 'alpha'); |
| 100 | -$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 101 | -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used |
|
| 100 | +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 101 | +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used |
|
| 102 | 102 | $lineid = GETPOSTINT('lineid'); |
| 103 | 103 | $userid = GETPOSTINT('userid'); |
| 104 | 104 | $search_ref = GETPOST('sf_ref', 'alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | setEventMessages('', $warningMsgLineList, 'warnings'); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result); |
|
| 270 | + header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result); |
|
| 271 | 271 | exit(); |
| 272 | 272 | } else { |
| 273 | 273 | $langs->load("errors"); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | // Validation |
| 359 | 359 | $object->fetch($id); |
| 360 | 360 | |
| 361 | - if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life |
|
| 361 | + if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life |
|
| 362 | 362 | getDolGlobalString('FAC_FORCE_DATE_VALIDATION') // If option enabled, we force invoice date |
| 363 | 363 | ) { |
| 364 | 364 | $object->date = dol_now(); |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | $error++; |
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | - $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
| 1090 | + $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
| 1091 | 1091 | $date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver'); |
| 1092 | 1092 | |
| 1093 | 1093 | // Replacement invoice |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | $object->note_private = trim(GETPOST('note_private', 'restricthtml')); |
| 1120 | 1120 | $object->ref_client = GETPOST('ref_client', 'alphanohtml'); |
| 1121 | 1121 | $object->ref_customer = GETPOST('ref_client', 'alphanohtml'); |
| 1122 | - $object->model_pdf = GETPOST('model', 'alphanohtml'); |
|
| 1122 | + $object->model_pdf = GETPOST('model', 'alphanohtml'); |
|
| 1123 | 1123 | $object->fk_project = GETPOSTINT('projectid'); |
| 1124 | 1124 | $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); |
| 1125 | 1125 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
@@ -1180,9 +1180,9 @@ discard block |
||
| 1180 | 1180 | $object->note_private = trim(GETPOST('note_private', 'restricthtml')); |
| 1181 | 1181 | $object->ref_client = GETPOST('ref_client', 'alphanohtml'); |
| 1182 | 1182 | $object->ref_customer = GETPOST('ref_client', 'alphanohtml'); |
| 1183 | - $object->model_pdf = GETPOST('model'); |
|
| 1183 | + $object->model_pdf = GETPOST('model'); |
|
| 1184 | 1184 | $object->fk_project = GETPOSTINT('projectid'); |
| 1185 | - $object->cond_reglement_id = 0; // No payment term for a credit note |
|
| 1185 | + $object->cond_reglement_id = 0; // No payment term for a credit note |
|
| 1186 | 1186 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
| 1187 | 1187 | $object->fk_account = GETPOSTINT('fk_account'); |
| 1188 | 1188 | //$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | $object->note_public = trim(GETPOST('note_public', 'restricthtml')); |
| 1506 | 1506 | $object->note_private = trim(GETPOST('note_private', 'restricthtml')); |
| 1507 | 1507 | $object->ref_client = GETPOST('ref_client'); |
| 1508 | - $object->ref_customer = GETPOST('ref_client'); |
|
| 1508 | + $object->ref_customer = GETPOST('ref_client'); |
|
| 1509 | 1509 | $object->model_pdf = GETPOST('model'); |
| 1510 | 1510 | $object->fk_project = GETPOSTINT('projectid'); |
| 1511 | 1511 | $object->cond_reglement_id = (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id')); |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | $element = $subelement = 'expedition'; |
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | - $object->origin = $origin; // deprecated |
|
| 1572 | + $object->origin = $origin; // deprecated |
|
| 1573 | 1573 | $object->origin_type = $origin; |
| 1574 | 1574 | $object->origin_id = $originid; |
| 1575 | 1575 | |
@@ -1604,7 +1604,7 @@ discard block |
||
| 1604 | 1604 | dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines or deposit lines"); |
| 1605 | 1605 | $result = $srcobject->fetch($object->origin_id); |
| 1606 | 1606 | |
| 1607 | - $i = -1; // Ensure initialised for static analysis, but with invalid idx. |
|
| 1607 | + $i = -1; // Ensure initialised for static analysis, but with invalid idx. |
|
| 1608 | 1608 | // If deposit invoice - down payment with 1 line (fixed amount or percent) |
| 1609 | 1609 | if (GETPOST('type') == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { |
| 1610 | 1610 | // Define the array $amountdeposit |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | if (!empty($origin) && !empty($originid)) { |
| 2008 | 2008 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 2009 | 2009 | |
| 2010 | - $object->origin = $origin; // deprecated |
|
| 2010 | + $object->origin = $origin; // deprecated |
|
| 2011 | 2011 | $object->origin_type = $origin; |
| 2012 | 2012 | $object->origin_id = $originid; |
| 2013 | 2013 | |
@@ -2033,7 +2033,7 @@ discard block |
||
| 2033 | 2033 | $line->fk_prev_id = $line->id; |
| 2034 | 2034 | $line->fetch_optionals(); |
| 2035 | 2035 | if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) { |
| 2036 | - $line->situation_percent = 0; // New situation percent must be 0 (No cumulative) |
|
| 2036 | + $line->situation_percent = 0; // New situation percent must be 0 (No cumulative) |
|
| 2037 | 2037 | } else { |
| 2038 | 2038 | $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note |
| 2039 | 2039 | } |
@@ -2150,7 +2150,7 @@ discard block |
||
| 2150 | 2150 | } else { |
| 2151 | 2151 | $db->rollback(); |
| 2152 | 2152 | $action = 'create'; |
| 2153 | - $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ? |
|
| 2153 | + $_GET["origin"] = $_POST["origin"]; // Keep GET and POST here ? |
|
| 2154 | 2154 | $_GET["originid"] = $_POST["originid"]; // Keep GET and POST here ? |
| 2155 | 2155 | setEventMessages($object->error, $object->errors, 'errors'); |
| 2156 | 2156 | } |
@@ -2708,7 +2708,7 @@ discard block |
||
| 2708 | 2708 | // Define special_code for special lines |
| 2709 | 2709 | $special_code = GETPOSTINT('special_code'); |
| 2710 | 2710 | if ($special_code == 3) { |
| 2711 | - $special_code = 0; // Options should not exists on invoices |
|
| 2711 | + $special_code = 0; // Options should not exists on invoices |
|
| 2712 | 2712 | } |
| 2713 | 2713 | |
| 2714 | 2714 | $line = new FactureLigne($db); |
@@ -3155,7 +3155,7 @@ discard block |
||
| 3155 | 3155 | |
| 3156 | 3156 | |
| 3157 | 3157 | if ($action == 'update_extras' && $usercancreate) { |
| 3158 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 3158 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 3159 | 3159 | $attribute_name = GETPOST('attribute', 'restricthtml'); |
| 3160 | 3160 | |
| 3161 | 3161 | // Fill array 'array_options' with data from add form |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | $fk_account = GETPOSTINT('fk_account'); |
| 3273 | 3273 | |
| 3274 | 3274 | // Load objectsrc |
| 3275 | - $objectsrc = null; // Initialise |
|
| 3275 | + $objectsrc = null; // Initialise |
|
| 3276 | 3276 | //$remise_absolue = 0; |
| 3277 | 3277 | if (!empty($origin) && !empty($originid)) { |
| 3278 | 3278 | // Parse element/subelement (ex: project_task) |
@@ -3283,7 +3283,7 @@ discard block |
||
| 3283 | 3283 | $subelement = $regs[2]; |
| 3284 | 3284 | } |
| 3285 | 3285 | |
| 3286 | - $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
| 3286 | + $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
| 3287 | 3287 | $date_pointoftax = dol_mktime(0, 0, 0, GETPOSTINT('date_pointoftaxmonth'), GETPOSTINT('date_pointoftaxday'), GETPOSTINT('date_pointoftaxyear'), 'tzserver'); |
| 3288 | 3288 | |
| 3289 | 3289 | if ($element == 'project') { |
@@ -3361,8 +3361,8 @@ discard block |
||
| 3361 | 3361 | $fk_account = (!empty($expesrc->fk_account) ? $expesrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); |
| 3362 | 3362 | |
| 3363 | 3363 | if (isModEnabled('multicurrency')) { |
| 3364 | - $currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code)); |
|
| 3365 | - $currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx)); |
|
| 3364 | + $currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code)); |
|
| 3365 | + $currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx)); |
|
| 3366 | 3366 | } |
| 3367 | 3367 | |
| 3368 | 3368 | //Replicate extrafields |
@@ -3455,7 +3455,7 @@ discard block |
||
| 3455 | 3455 | print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">'; |
| 3456 | 3456 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
| 3457 | 3457 | print '<input type="hidden" name="action" id="formtocreateaction" value="add">'; |
| 3458 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
| 3458 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
| 3459 | 3459 | if ($soc->id > 0) { |
| 3460 | 3460 | print '<input type="hidden" name="socid" value="'.$soc->id.'">'."\n"; |
| 3461 | 3461 | } |
@@ -3982,8 +3982,8 @@ discard block |
||
| 3982 | 3982 | if ($socid > 0) { |
| 3983 | 3983 | print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">'; |
| 3984 | 3984 | |
| 3985 | - $thirdparty = $soc; // used by object_discounts.tpl.php |
|
| 3986 | - $discount_type = 0; // used by object_discounts.tpl.php |
|
| 3985 | + $thirdparty = $soc; // used by object_discounts.tpl.php |
|
| 3986 | + $discount_type = 0; // used by object_discounts.tpl.php |
|
| 3987 | 3987 | $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid'))); |
| 3988 | 3988 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; |
| 3989 | 3989 | |
@@ -4024,7 +4024,7 @@ discard block |
||
| 4024 | 4024 | if (empty($retained_warranty)) { |
| 4025 | 4025 | if ($objectsrc !== null && property_exists($objectsrc, 'retained_warranty') && !empty($objectsrc->retained_warranty)) { // use previous situation value |
| 4026 | 4026 | // Facture->retained_warranty (does not exist on Expedition) |
| 4027 | - $retained_warranty = $objectsrc->retained_warranty; // @phan-suppress-current-line PhanUndeclaredProperty |
|
| 4027 | + $retained_warranty = $objectsrc->retained_warranty; // @phan-suppress-current-line PhanUndeclaredProperty |
|
| 4028 | 4028 | } |
| 4029 | 4029 | } |
| 4030 | 4030 | $retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT'); |
@@ -4515,7 +4515,7 @@ discard block |
||
| 4515 | 4515 | $nbMandated = 0; |
| 4516 | 4516 | foreach ($object->lines as $line) { |
| 4517 | 4517 | $res = $line->fetch_product(); |
| 4518 | - if ($res > 0) { |
|
| 4518 | + if ($res > 0) { |
|
| 4519 | 4519 | if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) { |
| 4520 | 4520 | $nbMandated++; |
| 4521 | 4521 | break; |
@@ -4727,7 +4727,7 @@ discard block |
||
| 4727 | 4727 | } |
| 4728 | 4728 | // Ref customer |
| 4729 | 4729 | $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, (int) $usercancreate, 'string', '', 0, 1); |
| 4730 | - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, (int) $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 4730 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, (int) $usercancreate, 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 4731 | 4731 | // Thirdparty |
| 4732 | 4732 | $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer'); |
| 4733 | 4733 | if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { |
@@ -5153,45 +5153,45 @@ discard block |
||
| 5153 | 5153 | } |
| 5154 | 5154 | print '<tr>'; |
| 5155 | 5155 | // Amount HT |
| 5156 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
| 5157 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
| 5156 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
| 5157 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
| 5158 | 5158 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 5159 | 5159 | // Multicurrency Amount HT |
| 5160 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 5160 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 5161 | 5161 | } |
| 5162 | 5162 | print '</tr>'; |
| 5163 | 5163 | |
| 5164 | 5164 | print '<tr>'; |
| 5165 | 5165 | // Amount VAT |
| 5166 | - print '<td>' . $langs->trans('AmountVAT') . '</td>'; |
|
| 5167 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
| 5166 | + print '<td>'.$langs->trans('AmountVAT').'</td>'; |
|
| 5167 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
| 5168 | 5168 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 5169 | 5169 | // Multicurrency Amount VAT |
| 5170 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 5170 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 5171 | 5171 | } |
| 5172 | 5172 | print '</tr>'; |
| 5173 | 5173 | |
| 5174 | 5174 | // Amount Local Taxes |
| 5175 | 5175 | if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { |
| 5176 | 5176 | print '<tr>'; |
| 5177 | - print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
| 5178 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
| 5177 | + print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
| 5178 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
| 5179 | 5179 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 5180 | 5180 | $object->multicurrency_total_localtax1 = (float) price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); |
| 5181 | 5181 | |
| 5182 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 5182 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 5183 | 5183 | } |
| 5184 | 5184 | print '</tr>'; |
| 5185 | 5185 | } |
| 5186 | 5186 | |
| 5187 | 5187 | if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { |
| 5188 | 5188 | print '<tr>'; |
| 5189 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
| 5190 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
| 5189 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
| 5190 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
| 5191 | 5191 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 5192 | 5192 | $object->multicurrency_total_localtax2 = (float) price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); |
| 5193 | 5193 | |
| 5194 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 5194 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 5195 | 5195 | } |
| 5196 | 5196 | print '</tr>'; |
| 5197 | 5197 | } |
@@ -5251,11 +5251,11 @@ discard block |
||
| 5251 | 5251 | |
| 5252 | 5252 | print '<tr>'; |
| 5253 | 5253 | // Amount TTC |
| 5254 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
| 5255 | - print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
| 5254 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
| 5255 | + print '<td class="nowrap amountcard right">'.price($sign * $object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
| 5256 | 5256 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
| 5257 | 5257 | // Multicurrency Amount TTC |
| 5258 | - print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
| 5258 | + print '<td class="nowrap amountcard right">'.price($sign * $object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
| 5259 | 5259 | } |
| 5260 | 5260 | print '</tr>'; |
| 5261 | 5261 | |
@@ -5929,7 +5929,7 @@ discard block |
||
| 5929 | 5929 | $langs->load("contracts"); |
| 5930 | 5930 | |
| 5931 | 5931 | if ($usercancreatecontract) { |
| 5932 | - print '<a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a>'; |
|
| 5932 | + print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>'; |
|
| 5933 | 5933 | } |
| 5934 | 5934 | } |
| 5935 | 5935 | } |
@@ -6155,7 +6155,7 @@ discard block |
||
| 6155 | 6155 | if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions) |
| 6156 | 6156 | $enableDelete = false; |
| 6157 | 6157 | $deleteHref = '#'; |
| 6158 | - if ($isErasable > 0 && ! $objectidnext) { |
|
| 6158 | + if ($isErasable > 0 && !$objectidnext) { |
|
| 6159 | 6159 | $deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken(); |
| 6160 | 6160 | $enableDelete = true; |
| 6161 | 6161 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $this->titre = $obj->title; // deprecated |
| 661 | 661 | $this->title = $obj->title; |
| 662 | 662 | $this->ref = $obj->title; |
| 663 | - $this->subtype = $obj->subtype; |
|
| 663 | + $this->subtype = $obj->subtype; |
|
| 664 | 664 | $this->suspended = $obj->suspended; |
| 665 | 665 | $this->total_ht = $obj->total_ht; |
| 666 | 666 | $this->total_tva = $obj->total_tva; |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $this->fk_societe_rib = $obj->fk_societe_rib; |
| 682 | 682 | $this->note_private = $obj->note_private; |
| 683 | 683 | $this->note_public = $obj->note_public; |
| 684 | - $this->user_author = $obj->fk_user_author; // deprecated |
|
| 684 | + $this->user_author = $obj->fk_user_author; // deprecated |
|
| 685 | 685 | $this->user_creation_id = $obj->fk_user_author; |
| 686 | 686 | $this->model_pdf = $obj->model_pdf; |
| 687 | 687 | //$this->special_code = $obj->special_code; |
@@ -780,35 +780,35 @@ discard block |
||
| 780 | 780 | $objp = $this->db->fetch_object($result); |
| 781 | 781 | $line = new FactureLigneRec($this->db); |
| 782 | 782 | |
| 783 | - $line->id = $objp->rowid; |
|
| 783 | + $line->id = $objp->rowid; |
|
| 784 | 784 | $line->rowid = $objp->rowid; |
| 785 | - $line->fk_facture = $objp->fk_facture; |
|
| 786 | - $line->fk_parent_line = $objp->fk_parent_line; |
|
| 785 | + $line->fk_facture = $objp->fk_facture; |
|
| 786 | + $line->fk_parent_line = $objp->fk_parent_line; |
|
| 787 | 787 | $line->desc = $objp->description; // Description line |
| 788 | 788 | $line->description = $objp->description; // Description line |
| 789 | - $line->ref = $objp->product_ref; // Ref product |
|
| 789 | + $line->ref = $objp->product_ref; // Ref product |
|
| 790 | 790 | $line->product_ref = $objp->product_ref; // Ref product |
| 791 | - $line->libelle = $objp->product_label; // deprecated |
|
| 791 | + $line->libelle = $objp->product_label; // deprecated |
|
| 792 | 792 | $line->product_label = $objp->product_label; // Label product |
| 793 | 793 | $line->product_desc = $objp->product_desc; // Description product |
| 794 | 794 | $line->product_type = $objp->product_type; // Type of line |
| 795 | - $line->fk_product_type = $objp->fk_product_type; // Type of product |
|
| 795 | + $line->fk_product_type = $objp->fk_product_type; // Type of product |
|
| 796 | 796 | $line->qty = $objp->qty; |
| 797 | - $line->subprice = $objp->subprice; |
|
| 797 | + $line->subprice = $objp->subprice; |
|
| 798 | 798 | |
| 799 | 799 | $line->label = $objp->custom_label; // @deprecated |
| 800 | 800 | |
| 801 | 801 | $line->vat_src_code = $objp->vat_src_code; |
| 802 | - $line->tva_tx = $objp->tva_tx; |
|
| 802 | + $line->tva_tx = $objp->tva_tx; |
|
| 803 | 803 | $line->localtax1_tx = $objp->localtax1_tx; |
| 804 | 804 | $line->localtax2_tx = $objp->localtax2_tx; |
| 805 | 805 | $line->localtax1_type = $objp->localtax1_type; |
| 806 | 806 | $line->localtax2_type = $objp->localtax2_type; |
| 807 | 807 | $line->remise_percent = $objp->remise_percent; |
| 808 | 808 | //$line->fk_remise_except = $objp->fk_remise_except; |
| 809 | - $line->fk_product = $objp->fk_product; |
|
| 810 | - $line->date_start_fill = $objp->date_start_fill; |
|
| 811 | - $line->date_end_fill = $objp->date_end_fill; |
|
| 809 | + $line->fk_product = $objp->fk_product; |
|
| 810 | + $line->date_start_fill = $objp->date_start_fill; |
|
| 811 | + $line->date_end_fill = $objp->date_end_fill; |
|
| 812 | 812 | $line->info_bits = $objp->info_bits; |
| 813 | 813 | $line->total_ht = $objp->total_ht; |
| 814 | 814 | $line->total_tva = $objp->total_tva; |
@@ -824,15 +824,15 @@ discard block |
||
| 824 | 824 | $line->marge_tx = (string) $marginInfos[1]; |
| 825 | 825 | $line->marque_tx = (string) $marginInfos[2]; |
| 826 | 826 | $line->rang = $objp->rang; |
| 827 | - $line->special_code = $objp->special_code; |
|
| 828 | - $line->fk_unit = $objp->fk_unit; |
|
| 829 | - $line->fk_contract_line = $objp->fk_contract_line; |
|
| 827 | + $line->special_code = $objp->special_code; |
|
| 828 | + $line->fk_unit = $objp->fk_unit; |
|
| 829 | + $line->fk_contract_line = $objp->fk_contract_line; |
|
| 830 | 830 | |
| 831 | 831 | $line->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
| 832 | 832 | |
| 833 | 833 | // Ne plus utiliser |
| 834 | - $line->price = $objp->price; |
|
| 835 | - $line->remise = $objp->remise; |
|
| 834 | + $line->price = $objp->price; |
|
| 835 | + $line->remise = $objp->remise; |
|
| 836 | 836 | |
| 837 | 837 | $line->fetch_optionals(); |
| 838 | 838 | |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | |
| 1426 | 1426 | $facture->type = self::TYPE_STANDARD; |
| 1427 | 1427 | $facture->subtype = $facturerec->subtype; |
| 1428 | - $facture->statut = self::STATUS_DRAFT; // deprecated |
|
| 1428 | + $facture->statut = self::STATUS_DRAFT; // deprecated |
|
| 1429 | 1429 | $facture->status = self::STATUS_DRAFT; |
| 1430 | 1430 | $facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. |
| 1431 | 1431 | $facture->socid = $facturerec->socid; |
@@ -1577,7 +1577,7 @@ discard block |
||
| 1577 | 1577 | } |
| 1578 | 1578 | $result .= $linkend; |
| 1579 | 1579 | global $action; |
| 1580 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1580 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1581 | 1581 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1582 | 1582 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1583 | 1583 | if ($reshook > 0) { |
@@ -1837,7 +1837,7 @@ discard block |
||
| 1837 | 1837 | |
| 1838 | 1838 | if (empty($option) || $option != 'nolines') { |
| 1839 | 1839 | // Lines |
| 1840 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1840 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1841 | 1841 | $xnbp = 0; |
| 1842 | 1842 | while ($xnbp < $nbp) { |
| 1843 | 1843 | $line = new FactureLigne($this->db); |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | $resSuspend = $this->setValueFrom('suspended', 1); |
| 2030 | 2030 | |
| 2031 | 2031 | if ($resSuspend <= 0) { |
| 2032 | - dol_syslog(__METHOD__ . '::setValueFrom Error : ' . $this->error, LOG_ERR); |
|
| 2032 | + dol_syslog(__METHOD__.'::setValueFrom Error : '.$this->error, LOG_ERR); |
|
| 2033 | 2033 | return -1; |
| 2034 | 2034 | } |
| 2035 | 2035 | } |
@@ -2369,9 +2369,9 @@ discard block |
||
| 2369 | 2369 | if ($result) { |
| 2370 | 2370 | $objp = $this->db->fetch_object($result); |
| 2371 | 2371 | |
| 2372 | - $this->id = $objp->rowid; |
|
| 2373 | - $this->fk_facture = $objp->fk_facture; |
|
| 2374 | - $this->fk_parent_line = $objp->fk_parent_line; |
|
| 2372 | + $this->id = $objp->rowid; |
|
| 2373 | + $this->fk_facture = $objp->fk_facture; |
|
| 2374 | + $this->fk_parent_line = $objp->fk_parent_line; |
|
| 2375 | 2375 | $this->label = $objp->custom_label; // Label line |
| 2376 | 2376 | $this->desc = $objp->description; // Description line |
| 2377 | 2377 | $this->description = $objp->description; // Description line |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $objp = $this->db->fetch_object($result); |
| 228 | 228 | |
| 229 | 229 | if (!$objp) { |
| 230 | - $this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql; |
|
| 230 | + $this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql; |
|
| 231 | 231 | return 0; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $this->multicurrency_total_tva = $objp->multicurrency_total_tva; |
| 289 | 289 | $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; |
| 290 | 290 | |
| 291 | - $this->packaging = $objp->packaging; |
|
| 291 | + $this->packaging = $objp->packaging; |
|
| 292 | 292 | |
| 293 | 293 | $this->fetch_optionals(); |
| 294 | 294 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null"); |
| 657 | 657 | $sql .= ", product_type=".$this->product_type; |
| 658 | 658 | $sql .= ", info_bits='".$this->db->escape((string) $this->info_bits)."'"; |
| 659 | - $sql .= ", special_code=" . (int) $this->special_code; |
|
| 659 | + $sql .= ", special_code=".(int) $this->special_code; |
|
| 660 | 660 | if (empty($this->skip_update_total)) { |
| 661 | 661 | $sql .= ", total_ht=".price2num($this->total_ht); |
| 662 | 662 | $sql .= ", total_tva=".price2num($this->total_tva); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | // Put here all includes required by your class file |
| 31 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 31 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Class for Position |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | // Clear fields |
| 300 | 300 | if (property_exists($object, 'ref')) { |
| 301 | - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_" . $object->ref : $this->fields['ref']['default']; |
|
| 301 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
| 302 | 302 | } |
| 303 | 303 | if (property_exists($object, 'status')) { |
| 304 | 304 | $object->status = self::STATUS_DRAFT; |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | $sql = 'SELECT '; |
| 410 | 410 | $sql .= $this->getFieldList('t'); |
| 411 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 411 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 412 | 412 | if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
| 413 | - $sql .= ' WHERE t.entity IN (' . getEntity($this->element) . ')'; |
|
| 413 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 414 | 414 | } else { |
| 415 | 415 | $sql .= ' WHERE 1 = 1'; |
| 416 | 416 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $sql .= $this->db->order($sortfield, $sortorder); |
| 429 | 429 | } |
| 430 | 430 | if (!empty($limit)) { |
| 431 | - $sql .= ' ' . $this->db->plimit($limit, $offset); |
|
| 431 | + $sql .= ' '.$this->db->plimit($limit, $offset); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $resql = $this->db->query($sql); |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | return $records; |
| 451 | 451 | } else { |
| 452 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 453 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 452 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 453 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 454 | 454 | |
| 455 | 455 | return -1; |
| 456 | 456 | } |
@@ -511,13 +511,13 @@ discard block |
||
| 511 | 511 | { |
| 512 | 512 | global $conf, $langs; |
| 513 | 513 | |
| 514 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 514 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 515 | 515 | |
| 516 | 516 | $error = 0; |
| 517 | 517 | |
| 518 | 518 | // Protection |
| 519 | 519 | if ($this->status == self::STATUS_VALIDATED) { |
| 520 | - dol_syslog(get_class($this) . "::validate action abandoned: already validated", LOG_WARNING); |
|
| 520 | + dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING); |
|
| 521 | 521 | return 0; |
| 522 | 522 | } |
| 523 | 523 | |
@@ -543,18 +543,18 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | if (!empty($num)) { |
| 545 | 545 | // Validate |
| 546 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element; |
|
| 547 | - $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
|
| 548 | - $sql .= " status = " . self::STATUS_VALIDATED; |
|
| 546 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
| 547 | + $sql .= " SET ref = '".$this->db->escape($num)."',"; |
|
| 548 | + $sql .= " status = ".self::STATUS_VALIDATED; |
|
| 549 | 549 | if (!empty($this->fields['date_validation'])) { |
| 550 | - $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; |
|
| 550 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
| 551 | 551 | } |
| 552 | 552 | if (!empty($this->fields['fk_user_valid'])) { // @phan-suppress-current-line PhanTypeMismatchProperty |
| 553 | - $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
| 553 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 554 | 554 | } |
| 555 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 555 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 556 | 556 | |
| 557 | - dol_syslog(get_class($this) . "::validate()", LOG_DEBUG); |
|
| 557 | + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
|
| 558 | 558 | $resql = $this->db->query($sql); |
| 559 | 559 | if (!$resql) { |
| 560 | 560 | dol_print_error($this->db); |
@@ -578,8 +578,8 @@ discard block |
||
| 578 | 578 | // Rename directory if dir was a temporary ref |
| 579 | 579 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
| 580 | 580 | // Now we rename also files into index |
| 581 | - $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) . "'"; |
|
| 582 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'position/" . $this->db->escape($this->ref) . "' and entity = " . $conf->entity; |
|
| 581 | + $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)."'"; |
|
| 582 | + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'position/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; |
|
| 583 | 583 | $resql = $this->db->query($sql); |
| 584 | 584 | if (!$resql) { |
| 585 | 585 | $error++; |
@@ -596,20 +596,20 @@ discard block |
||
| 596 | 596 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
| 597 | 597 | $oldref = dol_sanitizeFileName($this->ref); |
| 598 | 598 | $newref = dol_sanitizeFileName($num); |
| 599 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
| 600 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
| 599 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
| 600 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
| 601 | 601 | if (!$error && file_exists($dirsource)) { |
| 602 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
| 602 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
| 603 | 603 | |
| 604 | 604 | if (@rename($dirsource, $dirdest)) { |
| 605 | 605 | dol_syslog("Rename ok"); |
| 606 | 606 | // Rename docs starting with $oldref with $newref |
| 607 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
| 607 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
| 608 | 608 | foreach ($listoffiles as $fileentry) { |
| 609 | 609 | $dirsource = $fileentry['name']; |
| 610 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
| 611 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
| 612 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
| 610 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
| 611 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
| 612 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
| 613 | 613 | @rename($dirsource, $dirdest); |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -725,14 +725,14 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | $result = ''; |
| 727 | 727 | |
| 728 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
| 728 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
| 729 | 729 | if (isset($this->status)) { |
| 730 | - $label .= ' ' . $this->getLibStatut(5); |
|
| 730 | + $label .= ' '.$this->getLibStatut(5); |
|
| 731 | 731 | } |
| 732 | 732 | $label .= '<br>'; |
| 733 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 733 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 734 | 734 | |
| 735 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
| 735 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
| 736 | 736 | |
| 737 | 737 | if ($option != 'nolink') { |
| 738 | 738 | // Add param to save lastsearch_values or not |
@@ -749,20 +749,20 @@ discard block |
||
| 749 | 749 | if (empty($notooltip)) { |
| 750 | 750 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
| 751 | 751 | $label = $langs->trans("ShowPosition"); |
| 752 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 752 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 753 | 753 | } |
| 754 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 755 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 754 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 755 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 756 | 756 | } else { |
| 757 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
| 757 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | if ($option == 'nolink') { |
| 761 | 761 | $linkstart = '<span'; |
| 762 | 762 | } else { |
| 763 | - $linkstart = '<a href="' . $url . '"'; |
|
| 763 | + $linkstart = '<a href="'.$url.'"'; |
|
| 764 | 764 | } |
| 765 | - $linkstart .= $linkclose . '>'; |
|
| 765 | + $linkstart .= $linkclose.'>'; |
|
| 766 | 766 | if ($option == 'nolink') { |
| 767 | 767 | $linkend = '</span>'; |
| 768 | 768 | } else { |
@@ -773,29 +773,29 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | if (empty($this->showphoto_on_popup)) { |
| 775 | 775 | if ($withpicto) { |
| 776 | - $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); |
|
| 776 | + $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 | 777 | } |
| 778 | 778 | } else { |
| 779 | 779 | if ($withpicto) { |
| 780 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 780 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 781 | 781 | |
| 782 | 782 | list($class, $module) = explode('@', $this->picto); |
| 783 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
| 783 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
| 784 | 784 | $filearray = dol_dir_list($upload_dir, "files"); |
| 785 | 785 | $filename = $filearray[0]['name']; |
| 786 | 786 | if (!empty($filename)) { |
| 787 | 787 | $pospoint = strpos($filearray[0]['name'], '.'); |
| 788 | 788 | |
| 789 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
| 790 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
| 791 | - $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>'; |
|
| 789 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
| 790 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
| 791 | + $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>'; |
|
| 792 | 792 | } else { |
| 793 | - $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>'; |
|
| 793 | + $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>'; |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | $result .= '</div>'; |
| 797 | 797 | } else { |
| 798 | - $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); |
|
| 798 | + $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); |
|
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | } |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - $statusType = 'status' . $status; |
|
| 861 | + $statusType = 'status'.$status; |
|
| 862 | 862 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
| 863 | 863 | if ($status == self::STATUS_CANCELED) { |
| 864 | 864 | $statusType = 'status6'; |
@@ -946,8 +946,8 @@ discard block |
||
| 946 | 946 | { |
| 947 | 947 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
| 948 | 948 | $sql .= ' fk_user_creat, fk_user_modif'; |
| 949 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 950 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
| 949 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 950 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
| 951 | 951 | $result = $this->db->query($sql); |
| 952 | 952 | if ($result) { |
| 953 | 953 | if ($this->db->num_rows($result)) { |
@@ -1020,20 +1020,20 @@ discard block |
||
| 1020 | 1020 | if (getDolGlobalString('hrm_POSITION_ADDON')) { |
| 1021 | 1021 | $mybool = false; |
| 1022 | 1022 | |
| 1023 | - $file = getDolGlobalString('hrm_POSITION_ADDON') . ".php"; |
|
| 1023 | + $file = getDolGlobalString('hrm_POSITION_ADDON').".php"; |
|
| 1024 | 1024 | $classname = getDolGlobalString('hrm_POSITION_ADDON'); |
| 1025 | 1025 | |
| 1026 | 1026 | // Include file with class |
| 1027 | 1027 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
| 1028 | 1028 | foreach ($dirmodels as $reldir) { |
| 1029 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
| 1029 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
| 1030 | 1030 | |
| 1031 | 1031 | // Load file with numbering class (if found) |
| 1032 | 1032 | $mybool = ((bool) @include_once $dir.$file) || $mybool; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | if (!$mybool) { |
| 1036 | - dol_print_error(null, "Failed to include file " . $file); |
|
| 1036 | + dol_print_error(null, "Failed to include file ".$file); |
|
| 1037 | 1037 | return ''; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | return ""; |
| 1051 | 1051 | } |
| 1052 | 1052 | } else { |
| 1053 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
| 1053 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
| 1054 | 1054 | return ""; |
| 1055 | 1055 | } |
| 1056 | 1056 | } else { |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | |
| 1156 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
| 1156 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
| 1157 | 1157 | |
| 1158 | 1158 | /** |
| 1159 | 1159 | * Class PositionLine. You can also remove this and generate a CRUD class for lines objects. |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | } |
| 669 | 669 | $txlocaltax1 = price2num($txlocaltax1); |
| 670 | 670 | $txlocaltax2 = price2num($txlocaltax2); |
| 671 | - $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
| 671 | + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
| 672 | 672 | if ($price_base_type == 'HT') { |
| 673 | 673 | $pu = $pu_ht; |
| 674 | 674 | } else { |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | } |
| 917 | 917 | $txlocaltax1 = price2num($txlocaltax1); |
| 918 | 918 | $txlocaltax2 = price2num($txlocaltax2); |
| 919 | - $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
| 919 | + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
| 920 | 920 | if (empty($qty) && empty($special_code)) { |
| 921 | 921 | $special_code = 3; // Set option tag |
| 922 | 922 | } |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | if ($objsoc->id > 0 && !empty($object->lines)) { |
| 1514 | 1514 | if ($update_prices === true && getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { |
| 1515 | 1515 | // If price per customer |
| 1516 | - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; |
|
| 1516 | + require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; |
|
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | foreach ($object->lines as $line) { |
@@ -1546,9 +1546,9 @@ discard block |
||
| 1546 | 1546 | foreach ($prodcustprice->lines as $k => $custprice_line) { |
| 1547 | 1547 | if ($custprice_line->date_begin <= $date_now && (empty($custprice_line->date_end) || $date_now <= $custprice_line->date_end)) { |
| 1548 | 1548 | $pu_ht = price($custprice_line->price); |
| 1549 | - $tva_tx = ($custprice_line->default_vat_code ? $custprice_line->tva_tx . ' (' . $custprice_line->default_vat_code . ' )' : $custprice_line->tva_tx); |
|
| 1549 | + $tva_tx = ($custprice_line->default_vat_code ? $custprice_line->tva_tx.' ('.$custprice_line->default_vat_code.' )' : $custprice_line->tva_tx); |
|
| 1550 | 1550 | if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { |
| 1551 | - $tva_tx .= ' (' . $custprice_line->default_vat_code . ')'; |
|
| 1551 | + $tva_tx .= ' ('.$custprice_line->default_vat_code.')'; |
|
| 1552 | 1552 | } |
| 1553 | 1553 | $remise_percent = $custprice_line->discount_percent; |
| 1554 | 1554 | break; |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | $this->ref_customer = $obj->ref_client; |
| 1715 | 1715 | $this->ref_ext = $obj->ref_ext; |
| 1716 | 1716 | |
| 1717 | - $this->total = $obj->total_ttc; // TODO deprecated |
|
| 1717 | + $this->total = $obj->total_ttc; // TODO deprecated |
|
| 1718 | 1718 | $this->total_ttc = $obj->total_ttc; |
| 1719 | 1719 | $this->total_ht = $obj->total_ht; |
| 1720 | 1720 | $this->total_tva = $obj->total_tva; |
@@ -2634,7 +2634,7 @@ discard block |
||
| 2634 | 2634 | */ |
| 2635 | 2635 | public function closeProposal($user, $status, $note_private = '', $notrigger = 0, $note_public = '') |
| 2636 | 2636 | { |
| 2637 | - global $langs,$conf; |
|
| 2637 | + global $langs, $conf; |
|
| 2638 | 2638 | |
| 2639 | 2639 | $error = 0; |
| 2640 | 2640 | $now = dol_now(); |
@@ -2669,10 +2669,10 @@ discard block |
||
| 2669 | 2669 | if ($resql) { |
| 2670 | 2670 | // Status self::STATUS_REFUSED by default |
| 2671 | 2671 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); |
| 2672 | - $triggerName = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
| 2672 | + $triggerName = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
| 2673 | 2673 | |
| 2674 | 2674 | if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED |
| 2675 | - $triggerName = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
| 2675 | + $triggerName = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
| 2676 | 2676 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL', $this->model_pdf); |
| 2677 | 2677 | |
| 2678 | 2678 | // The connected company is classified as a client |
@@ -2840,10 +2840,10 @@ discard block |
||
| 2840 | 2840 | |
| 2841 | 2841 | $this->db->begin(); |
| 2842 | 2842 | |
| 2843 | - $sql = "UPDATE ". MAIN_DB_PREFIX . $this->table_element; |
|
| 2844 | - $sql .= " SET fk_statut = " . self::STATUS_CANCELED . ","; |
|
| 2845 | - $sql .= " fk_user_modif = " . ((int) $user->id); |
|
| 2846 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 2843 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
| 2844 | + $sql .= " SET fk_statut = ".self::STATUS_CANCELED.","; |
|
| 2845 | + $sql .= " fk_user_modif = ".((int) $user->id); |
|
| 2846 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 2847 | 2847 | |
| 2848 | 2848 | dol_syslog(get_class($this)."::cancel", LOG_DEBUG); |
| 2849 | 2849 | if ($this->db->query($sql)) { |
@@ -3206,7 +3206,7 @@ discard block |
||
| 3206 | 3206 | } |
| 3207 | 3207 | } |
| 3208 | 3208 | if (file_exists($dir)) { |
| 3209 | - $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
| 3209 | + $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
| 3210 | 3210 | if (!$res) { |
| 3211 | 3211 | $this->error = 'ErrorFailToDeleteDir'; |
| 3212 | 3212 | $this->errors[] = $this->error; |
@@ -3610,7 +3610,7 @@ discard block |
||
| 3610 | 3610 | $this->multicurrency_code = $conf->currency; |
| 3611 | 3611 | |
| 3612 | 3612 | // Lines |
| 3613 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 3613 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 3614 | 3614 | $xnbp = 0; |
| 3615 | 3615 | while ($xnbp < $nbp) { |
| 3616 | 3616 | $line = new PropaleLigne($this->db); |
@@ -3940,7 +3940,7 @@ discard block |
||
| 3940 | 3940 | } |
| 3941 | 3941 | |
| 3942 | 3942 | global $action; |
| 3943 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 3943 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 3944 | 3944 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 3945 | 3945 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 3946 | 3946 | if ($reshook > 0) { |
@@ -130,13 +130,13 @@ |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | // Cache or not |
| 133 | -$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash |
|
| 133 | +$cachestring = GETPOST("cache", 'aZ09'); // May be 1, or an int (delay in second of the cache if < 999999, or a timestamp), or a hash |
|
| 134 | 134 | $cachedelay = GETPOSTINT('cachedelay') ? GETPOSTINT('cachedelay') : ((is_numeric($cachestring) && (int) $cachestring > 1 && (int) $cachestring < 999999) ? $cachestring : '3600'); |
| 135 | 135 | if ($cachestring || image_format_supported($original_file) >= 0) { |
| 136 | 136 | // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. |
| 137 | 137 | header('Cache-Control: max-age='.$cachedelay.', public, must-revalidate'); |
| 138 | 138 | header('Pragma: cache'); // This is to avoid having Pragma: no-cache |
| 139 | - header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $cachedelay).' GMT'); // This is to avoid to have Expires set by proxy or web server |
|
| 139 | + header('Expires: '.gmdate('D, d M Y H:i:s', time() + (int) $cachedelay).' GMT'); // This is to avoid to have Expires set by proxy or web server |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $refname = basename(dirname($original_file)."/"); |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | if (!defined('NOBROWSERNOTIF')) { |
| 50 | 50 | define('NOBROWSERNOTIF', '1'); |
| 51 | 51 | } |
| 52 | -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 52 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 53 | 53 | if (is_numeric($entity)) { |
| 54 | 54 | define("DOLENTITY", $entity); |
| 55 | 55 | } |
| 56 | 56 | include '../../main.inc.php'; |
| 57 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 57 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 58 | 58 | /** |
| 59 | 59 | * @var Conf $conf |
| 60 | 60 | * @var DoliDB $db |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $signature = GETPOST('signaturebase64'); |
| 69 | 69 | $ref = GETPOST('ref', 'aZ09'); |
| 70 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 70 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 71 | 71 | $SECUREKEY = GETPOST("securekey"); // Secure key |
| 72 | 72 | $online_sign_name = GETPOST("onlinesignname"); |
| 73 | 73 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $securekeyseed = getDolGlobalString(strtoupper($type).'_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 92 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
| 91 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 92 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context |
@@ -116,29 +116,29 @@ discard block |
||
| 116 | 116 | $data = base64_decode($signature); |
| 117 | 117 | |
| 118 | 118 | if ($mode == "propale" || $mode == 'proposal') { |
| 119 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 120 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 119 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 120 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 121 | 121 | $object = new Propal($db); |
| 122 | 122 | $object->fetch(0, $ref); |
| 123 | 123 | |
| 124 | 124 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; |
| 125 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 125 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 126 | 126 | |
| 127 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 128 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 127 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 128 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 129 | 129 | $langs->loadLangs(array("main", "companies")); |
| 130 | 130 | |
| 131 | 131 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 132 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 133 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 134 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 135 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 132 | + $filename = "signatures/".$date."_signature.png"; |
|
| 133 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 134 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 135 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 136 | 136 | $error++; |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (!$error) { |
| 141 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 141 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 142 | 142 | if ($return == false) { |
| 143 | 143 | $error++; |
| 144 | 144 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -148,13 +148,13 @@ discard block |
||
| 148 | 148 | if (!$error) { |
| 149 | 149 | // Defined modele of doc |
| 150 | 150 | $last_main_doc_file = $object->last_main_doc; |
| 151 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 151 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 152 | 152 | |
| 153 | 153 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 154 | 154 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 155 | 155 | |
| 156 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 157 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 156 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 157 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 158 | 158 | |
| 159 | 159 | if (dol_is_file($sourcefile)) { |
| 160 | 160 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | //$pdf->Open(); |
| 180 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 180 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 181 | 181 | |
| 182 | 182 | $param = array(); |
| 183 | 183 | $param['online_sign_name'] = $online_sign_name; |
| 184 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 184 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 185 | 185 | |
| 186 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 186 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 187 | 187 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 188 | 188 | try { |
| 189 | 189 | $tppl = $pdf->importPage($i); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | dolPrintSignatureImage($pdf, $langs, $param); |
| 219 | 219 | } |
| 220 | 220 | } catch (Exception $e) { |
| 221 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 221 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 222 | 222 | $response = $e->getMessage(); |
| 223 | 223 | $error++; |
| 224 | 224 | } |
@@ -268,14 +268,14 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $online_sign_ip = getUserRemoteIP(); |
| 270 | 270 | |
| 271 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
| 272 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
| 273 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 274 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 271 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
| 272 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
| 273 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 274 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 275 | 275 | if ($online_sign_name) { |
| 276 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 276 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 277 | 277 | } |
| 278 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 278 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 279 | 279 | |
| 280 | 280 | dol_syslog(__FILE__, LOG_DEBUG); |
| 281 | 281 | $resql = $db->query($sql); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
| 295 | 295 | if ($result < 0) { |
| 296 | 296 | $error++; |
| 297 | - $response = "error in trigger " . $object->error; |
|
| 297 | + $response = "error in trigger ".$object->error; |
|
| 298 | 298 | } else { |
| 299 | 299 | $soc = new Societe($db); |
| 300 | 300 | $soc->id = $object->socid; |
@@ -323,25 +323,25 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } elseif ($mode == 'contract') { |
| 326 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 327 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 326 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 327 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 328 | 328 | $object = new Contrat($db); |
| 329 | 329 | $object->fetch(0, $ref); |
| 330 | 330 | |
| 331 | 331 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; |
| 332 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 332 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 333 | 333 | |
| 334 | 334 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 335 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 336 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 337 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 338 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 335 | + $filename = "signatures/".$date."_signature.png"; |
|
| 336 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 337 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 338 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 339 | 339 | $error++; |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | if (!$error) { |
| 344 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 344 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 345 | 345 | if ($return == false) { |
| 346 | 346 | $error++; |
| 347 | 347 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | if (!$error) { |
| 352 | 352 | // Defined modele of doc |
| 353 | 353 | $last_main_doc_file = $object->last_main_doc; |
| 354 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 354 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 355 | 355 | |
| 356 | 356 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 357 | 357 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 358 | 358 | |
| 359 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 360 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 359 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 360 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 361 | 361 | |
| 362 | 362 | if (dol_is_file($sourcefile)) { |
| 363 | 363 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -380,13 +380,13 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | //$pdf->Open(); |
| 383 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 383 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 384 | 384 | |
| 385 | 385 | $param = array(); |
| 386 | 386 | $param['online_sign_name'] = $online_sign_name; |
| 387 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 387 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 388 | 388 | |
| 389 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 389 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 390 | 390 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 391 | 391 | try { |
| 392 | 392 | $tppl = $pdf->importPage($i); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | dolPrintSignatureImage($pdf, $langs, $param); |
| 418 | 418 | } |
| 419 | 419 | } catch (Exception $e) { |
| 420 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 420 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 421 | 421 | $response = $e->getMessage(); |
| 422 | 422 | $error++; |
| 423 | 423 | } |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'CONTRACT_MODIFY'); |
| 456 | 456 | } |
| 457 | 457 | } elseif ($mode == 'fichinter') { |
| 458 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 459 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 458 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 459 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 460 | 460 | $object = new Fichinter($db); |
| 461 | 461 | $object->fetch(0, $ref); |
| 462 | 462 | |
@@ -465,20 +465,20 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | $langs->loadLangs(array("main", "companies")); |
| 467 | 467 | |
| 468 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 469 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 468 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 469 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 470 | 470 | |
| 471 | 471 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 472 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 473 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 474 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 475 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 472 | + $filename = "signatures/".$date."_signature.png"; |
|
| 473 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 474 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 475 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 476 | 476 | $error++; |
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | if (!$error) { |
| 481 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 481 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 482 | 482 | if ($return == false) { |
| 483 | 483 | $error++; |
| 484 | 484 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -488,13 +488,13 @@ discard block |
||
| 488 | 488 | if (!$error) { |
| 489 | 489 | // Defined modele of doc |
| 490 | 490 | $last_main_doc_file = $object->last_main_doc; |
| 491 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 491 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 492 | 492 | |
| 493 | 493 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 494 | 494 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 495 | 495 | |
| 496 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 497 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 496 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 497 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 498 | 498 | |
| 499 | 499 | if (dol_is_file($sourcefile)) { |
| 500 | 500 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -517,13 +517,13 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | //$pdf->Open(); |
| 520 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 520 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 521 | 521 | |
| 522 | 522 | $param = array(); |
| 523 | 523 | $param['online_sign_name'] = $online_sign_name; |
| 524 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 524 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 525 | 525 | |
| 526 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 526 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 527 | 527 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 528 | 528 | try { |
| 529 | 529 | $tppl = $pdf->importPage($i); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | dolPrintSignatureImage($pdf, $langs, $param); |
| 555 | 555 | } |
| 556 | 556 | } catch (Exception $e) { |
| 557 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 557 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 558 | 558 | $response = $e->getMessage(); |
| 559 | 559 | $error++; |
| 560 | 560 | } |
@@ -593,39 +593,39 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | } elseif ($mode == "societe_rib") { |
| 595 | 595 | $langs->load('withdrawals'); |
| 596 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 597 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 596 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 597 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 598 | 598 | $modelpath = "core/modules/bank/doc/"; |
| 599 | 599 | $object = new CompanyBankAccount($db); |
| 600 | 600 | $object->fetch(0, $ref); |
| 601 | 601 | if (!empty($object->id)) { |
| 602 | 602 | $object->fetch_thirdparty(); |
| 603 | 603 | |
| 604 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' . dol_sanitizeFileName((string) $object->thirdparty->id) . '/'; |
|
| 604 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/'.dol_sanitizeFileName((string) $object->thirdparty->id).'/'; |
|
| 605 | 605 | |
| 606 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 607 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 606 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 607 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 608 | 608 | $langs->loadLangs(array("main", "companies")); |
| 609 | 609 | |
| 610 | 610 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 611 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 612 | - if (!dol_is_dir($upload_dir . "signatures/")) { |
|
| 613 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 614 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 611 | + $filename = "signatures/".$date."_signature.png"; |
|
| 612 | + if (!dol_is_dir($upload_dir."signatures/")) { |
|
| 613 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 614 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 615 | 615 | $error++; |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | - if (!dol_is_writable($upload_dir . "signatures/")) { |
|
| 619 | - $response = "Error directory " . $upload_dir . "signatures/ is not writable"; |
|
| 618 | + if (!dol_is_writable($upload_dir."signatures/")) { |
|
| 619 | + $response = "Error directory ".$upload_dir."signatures/ is not writable"; |
|
| 620 | 620 | $error++; |
| 621 | 621 | } |
| 622 | 622 | if (!dol_is_writable(DOL_DATA_ROOT.'/admin/temp/')) { // This is used by TCPDF as working directory |
| 623 | - $response = "Error directory " . DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 623 | + $response = "Error directory ".DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 624 | 624 | $error++; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | if (!$error) { |
| 628 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 628 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 629 | 629 | if ($return == false) { |
| 630 | 630 | $error++; |
| 631 | 631 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -636,14 +636,14 @@ discard block |
||
| 636 | 636 | // Defined modele of doc |
| 637 | 637 | $last_main_doc_file = $object->last_main_doc; |
| 638 | 638 | $last_modelpdf = $object->model_pdf; |
| 639 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 639 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 640 | 640 | |
| 641 | 641 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 642 | 642 | $sourcefile = ''; |
| 643 | 643 | $newpdffilename = ''; |
| 644 | 644 | if ($last_modelpdf == 'sepamandate') { |
| 645 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
| 646 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
| 645 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
| 646 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
| 647 | 647 | } |
| 648 | 648 | if (dol_is_file($sourcefile)) { |
| 649 | 649 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -666,9 +666,9 @@ discard block |
||
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | //$pdf->Open(); |
| 669 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 669 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 670 | 670 | |
| 671 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 671 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 672 | 672 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 673 | 673 | try { |
| 674 | 674 | $tppl = $pdf->importPage($i); |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 677 | 677 | $pdf->useTemplate($tppl); |
| 678 | 678 | } catch (Exception $e) { |
| 679 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 679 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 680 | 680 | $response = $e->getMessage(); |
| 681 | 681 | $error++; |
| 682 | 682 | } |
@@ -692,18 +692,18 @@ discard block |
||
| 692 | 692 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
| 693 | 693 | } |
| 694 | 694 | foreach ($dirmodels as $reldir) { |
| 695 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
| 695 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
| 696 | 696 | // On vérifie l'emplacement du modele |
| 697 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
| 697 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
| 698 | 698 | if (file_exists($file)) { |
| 699 | 699 | $filefound = $file; |
| 700 | - $classname = 'pdf_' . $last_modelpdf; |
|
| 700 | + $classname = 'pdf_'.$last_modelpdf; |
|
| 701 | 701 | break; |
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if ($filefound === '') { |
| 706 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
| 706 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
| 707 | 707 | dol_syslog($response, LOG_ERR); |
| 708 | 708 | $error++; |
| 709 | 709 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | $param = array(); |
| 729 | 729 | $param['online_sign_name'] = $online_sign_name; |
| 730 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 730 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 731 | 731 | |
| 732 | 732 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
| 733 | 733 | // TODO Get position of box from PDF template |
@@ -763,16 +763,16 @@ discard block |
||
| 763 | 763 | |
| 764 | 764 | $online_sign_ip = getUserRemoteIP(); |
| 765 | 765 | |
| 766 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
| 766 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
| 767 | 767 | $sql .= " SET "; |
| 768 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 769 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 768 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 769 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 770 | 770 | if ($online_sign_name) { |
| 771 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 771 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 772 | 772 | } |
| 773 | 773 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
| 774 | 774 | |
| 775 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 775 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 776 | 776 | |
| 777 | 777 | dol_syslog(__FILE__, LOG_DEBUG); |
| 778 | 778 | $resql = $db->query($sql); |
@@ -798,8 +798,8 @@ discard block |
||
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | } elseif ($mode == 'expedition') { |
| 801 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 802 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 801 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 802 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 803 | 803 | |
| 804 | 804 | $object = new Expedition($db); |
| 805 | 805 | $object->fetch(0, $ref); |
@@ -809,20 +809,20 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | $langs->loadLangs(array("main", "companies")); |
| 811 | 811 | |
| 812 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 813 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 812 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 813 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 814 | 814 | |
| 815 | 815 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 816 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 817 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 818 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 819 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 816 | + $filename = "signatures/".$date."_signature.png"; |
|
| 817 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 818 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 819 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 820 | 820 | $error++; |
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | if (!$error) { |
| 825 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 825 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 826 | 826 | if ($return == false) { |
| 827 | 827 | $error++; |
| 828 | 828 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -835,17 +835,17 @@ discard block |
||
| 835 | 835 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 836 | 836 | // It seems document has never been generated, or was generated and then deleted. |
| 837 | 837 | // So we try to regenerate it with its default template. |
| 838 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 838 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 839 | 839 | $object->generateDocument($defaulttemplate, $langs); |
| 840 | 840 | } |
| 841 | 841 | $last_main_doc_file = $object->last_main_doc; |
| 842 | - $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 842 | + $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 843 | 843 | |
| 844 | 844 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 845 | 845 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 846 | 846 | |
| 847 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 848 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 847 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 848 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 849 | 849 | |
| 850 | 850 | if (dol_is_file($sourcefile)) { |
| 851 | 851 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -868,13 +868,13 @@ discard block |
||
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | //$pdf->Open(); |
| 871 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 871 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 872 | 872 | |
| 873 | 873 | $param = array(); |
| 874 | 874 | $param['online_sign_name'] = $online_sign_name; |
| 875 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 875 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 876 | 876 | |
| 877 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 877 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 878 | 878 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 879 | 879 | try { |
| 880 | 880 | $tppl = $pdf->importPage($i); |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | dolPrintSignatureImage($pdf, $langs, $param); |
| 894 | 894 | } |
| 895 | 895 | } catch (Exception $e) { |
| 896 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 896 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 897 | 897 | $response = $e->getMessage(); |
| 898 | 898 | $error++; |
| 899 | 899 | } |
@@ -954,8 +954,8 @@ discard block |
||
| 954 | 954 | */ |
| 955 | 955 | function dolPrintSignatureImage(TCPDF $pdf, $langs, $params) |
| 956 | 956 | { |
| 957 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 958 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 957 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 958 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 959 | 959 | $xforimgstart = $params['xforimgstart']; |
| 960 | 960 | $yforimgstart = $params['yforimgstart']; |
| 961 | 961 | $wforimg = $params['wforimg']; |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
| 964 | 964 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
| 965 | 965 | $pdf->SetTextColor(80, 80, 80); |
| 966 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Signature") . ': ' . dol_print_date(dol_now(), "day", false, $langs, true). ' - '.$params['online_sign_name'], 0, 'L'); |
|
| 966 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Signature").': '.dol_print_date(dol_now(), "day", false, $langs, true).' - '.$params['online_sign_name'], 0, 'L'); |
|
| 967 | 967 | //$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 968 | 968 | //$pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
| 969 | 969 | |