@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | const KEY_ID = 0; |
| 142 | 142 | const KEY_LABEL = 1; |
| 143 | - const KEY_TYPE = 2; // deprecated |
|
| 143 | + const KEY_TYPE = 2; // deprecated |
|
| 144 | 144 | const KEY_DEFAULT = 3; |
| 145 | 145 | const KEY_FIRST_LEVEL = 4; |
| 146 | 146 | const KEY_SECOND_LEVEL = 5; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | $moduleNameInConf = 'supplier_proposal'; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used) |
|
| 639 | + unset($conf->modules[$moduleNameInConf]); // Add this module in list of enabled modules so isModEnabled() will work (conf->module->enabled must no more be used) |
|
| 640 | 640 | |
| 641 | 641 | return 1; |
| 642 | 642 | } else { |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | $pathoffile = $this->getDescLongReadmeFound(); |
| 733 | 733 | |
| 734 | 734 | if ($pathoffile) { // Mostly for external modules |
| 735 | - $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb |
|
| 735 | + $content = file_get_contents($pathoffile, false, null, 0, 1024 * 1024); // Max size loaded 1Mb |
|
| 736 | 736 | |
| 737 | 737 | if ((float) DOL_VERSION >= 6.0) { |
| 738 | 738 | @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php'; |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | |
| 1498 | 1498 | $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; |
| 1499 | 1499 | $sql .= " WHERE file = '".$this->db->escape($file)."'"; |
| 1500 | - $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company |
|
| 1500 | + $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company |
|
| 1501 | 1501 | |
| 1502 | 1502 | dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); |
| 1503 | 1503 | $resql = $this->db->query($sql); |
@@ -1920,9 +1920,9 @@ discard block |
||
| 1920 | 1920 | |
| 1921 | 1921 | // If the module is active |
| 1922 | 1922 | foreach ($this->rights as $key => $value) { |
| 1923 | - $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity) |
|
| 1923 | + $r_id = $this->rights[$key][self::KEY_ID]; // permission id in llx_rights_def (not unique because primary key is couple id-entity) |
|
| 1924 | 1924 | $r_label = $this->rights[$key][self::KEY_LABEL]; |
| 1925 | - $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated |
|
| 1925 | + $r_type = $this->rights[$key][self::KEY_TYPE] ?? 'w'; // TODO deprecated |
|
| 1926 | 1926 | $r_default = $this->rights[$key][self::KEY_DEFAULT] ?? 0; |
| 1927 | 1927 | $r_perms = $this->rights[$key][self::KEY_FIRST_LEVEL] ?? ''; |
| 1928 | 1928 | $r_subperms = $this->rights[$key][self::KEY_SECOND_LEVEL] ?? ''; |
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | // condition to show or hide a user right (default: 1) (eg isModEnabled('anothermodule') or ($conf->global->MAIN_FEATURES_LEVEL > 0) or etc..) |
| 1949 | - $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1'; |
|
| 1949 | + $r_enabled = $this->rights[$key][self::KEY_ENABLED] ?? '1'; |
|
| 1950 | 1950 | |
| 1951 | 1951 | // Search if perm already present |
| 1952 | 1952 | $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def"; |
@@ -1964,7 +1964,7 @@ discard block |
||
| 1964 | 1964 | $sql .= ", libelle"; |
| 1965 | 1965 | $sql .= ", module"; |
| 1966 | 1966 | $sql .= ", module_origin"; |
| 1967 | - $sql .= ", type"; // TODO deprecated |
|
| 1967 | + $sql .= ", type"; // TODO deprecated |
|
| 1968 | 1968 | $sql .= ", bydefault"; |
| 1969 | 1969 | $sql .= ", perms"; |
| 1970 | 1970 | $sql .= ", subperms"; |
@@ -1977,13 +1977,13 @@ discard block |
||
| 1977 | 1977 | $sql .= ", '".$this->db->escape($r_label)."'"; |
| 1978 | 1978 | $sql .= ", '".$this->db->escape($r_module)."'"; |
| 1979 | 1979 | $sql .= ", '".$this->db->escape($r_module_origin)."'"; |
| 1980 | - $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated |
|
| 1980 | + $sql .= ", '".$this->db->escape($r_type)."'"; // TODO deprecated |
|
| 1981 | 1981 | $sql .= ", ".((int) $r_default); |
| 1982 | 1982 | $sql .= ", '".$this->db->escape($r_perms)."'"; |
| 1983 | 1983 | $sql .= ", '".$this->db->escape($r_subperms)."'"; |
| 1984 | 1984 | $sql .= ", '".$this->db->escape($r_enabled)."'"; |
| 1985 | 1985 | |
| 1986 | - $sql.= ")"; |
|
| 1986 | + $sql .= ")"; |
|
| 1987 | 1987 | |
| 1988 | 1988 | $resqlinsert = $this->db->query($sql, 1); |
| 1989 | 1989 | |
@@ -2583,36 +2583,36 @@ discard block |
||
| 2583 | 2583 | } |
| 2584 | 2584 | |
| 2585 | 2585 | if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { |
| 2586 | - $versionTitle = $langs->trans("Version").' '.$this->getVersion(1); |
|
| 2586 | + $versionTitle = $langs->trans("Version").' '.$this->getVersion(1); |
|
| 2587 | 2587 | if ($this->needUpdate) { |
| 2588 | 2588 | $versionTitle .= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion; |
| 2589 | 2589 | } |
| 2590 | 2590 | |
| 2591 | - $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >'; |
|
| 2592 | - $return .= $this->getVersion(1); |
|
| 2593 | - $return .= '</span>'; |
|
| 2591 | + $return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >'; |
|
| 2592 | + $return .= $this->getVersion(1); |
|
| 2593 | + $return .= '</span>'; |
|
| 2594 | 2594 | } |
| 2595 | 2595 | |
| 2596 | - $return .= '</div> |
|
| 2596 | + $return .= '</div> |
|
| 2597 | 2597 | <div class="info-box-content info-box-text-module'.(!getDolGlobalString($const_name) ? '' : ' info-box-module-enabled'.($versiontrans ? ' info-box-content-warning' : '')).'"> |
| 2598 | 2598 | <span class="info-box-title">'.$this->getName().'</span> |
| 2599 | 2599 | <span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>'; |
| 2600 | 2600 | |
| 2601 | - $return .= '<div class="valignmiddle inline-block info-box-more">'; |
|
| 2601 | + $return .= '<div class="valignmiddle inline-block info-box-more">'; |
|
| 2602 | 2602 | //if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' '; |
| 2603 | - $return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; |
|
| 2604 | - $return .= '</div><br>'; |
|
| 2605 | - |
|
| 2606 | - $return .= '<div class="valignmiddle inline-block info-box-actions">'; |
|
| 2607 | - $return .= '<div class="valignmiddle inline-block info-box-setup">'; |
|
| 2608 | - $return .= $codetoconfig; |
|
| 2609 | - $return .= '</div>'; |
|
| 2610 | - $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">'; |
|
| 2611 | - $return .= $codeenabledisable; |
|
| 2612 | - $return .= '</div>'; |
|
| 2613 | - $return .= '</div>'; |
|
| 2614 | - |
|
| 2615 | - $return .= ' |
|
| 2603 | + $return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $this->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>'; |
|
| 2604 | + $return .= '</div><br>'; |
|
| 2605 | + |
|
| 2606 | + $return .= '<div class="valignmiddle inline-block info-box-actions">'; |
|
| 2607 | + $return .= '<div class="valignmiddle inline-block info-box-setup">'; |
|
| 2608 | + $return .= $codetoconfig; |
|
| 2609 | + $return .= '</div>'; |
|
| 2610 | + $return .= '<div class="valignmiddle inline-block marginleftonly marginrightonly">'; |
|
| 2611 | + $return .= $codeenabledisable; |
|
| 2612 | + $return .= '</div>'; |
|
| 2613 | + $return .= '</div>'; |
|
| 2614 | + |
|
| 2615 | + $return .= ' |
|
| 2616 | 2616 | </div><!-- /.info-box-content --> |
| 2617 | 2617 | </div><!-- /.info-box --> |
| 2618 | 2618 | </div>'; |
@@ -2631,7 +2631,7 @@ discard block |
||
| 2631 | 2631 | { |
| 2632 | 2632 | require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; |
| 2633 | 2633 | if (!empty($this->url_last_version)) { |
| 2634 | - $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only |
|
| 2634 | + $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only |
|
| 2635 | 2635 | if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) { |
| 2636 | 2636 | // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . - |
| 2637 | 2637 | $this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/", "", $lastVersion['content']); |
@@ -2660,6 +2660,8 @@ |
||
| 2660 | 2660 | $this->dictionaries['tab'.$field][] = $dictionaryArray[$field]; |
| 2661 | 2661 | } |
| 2662 | 2662 | } |
| 2663 | - if ($langs && !in_array($langs, $this->dictionaries[$langs])) $this->dictionaries['langs'][] = $langs; |
|
| 2663 | + if ($langs && !in_array($langs, $this->dictionaries[$langs])) { |
|
| 2664 | + $this->dictionaries['langs'][] = $langs; |
|
| 2665 | + } |
|
| 2664 | 2666 | } |
| 2665 | 2667 | } |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | /** |
| 197 | 197 | * No signature |
| 198 | 198 | */ |
| 199 | - const STATUS_NO_SIGNATURE = 0; |
|
| 199 | + const STATUS_NO_SIGNATURE = 0; |
|
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | 202 | * Signed by sender |
| 203 | 203 | */ |
| 204 | - const STATUS_SIGNED_SENDER = 1; |
|
| 204 | + const STATUS_SIGNED_SENDER = 1; |
|
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * Signed by receiver |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | /** |
| 212 | 212 | * Signed by all |
| 213 | 213 | */ |
| 214 | - const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) |
|
| 214 | + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) |
|
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | $this->description = $obj->description; |
| 507 | 507 | $this->socid = $obj->fk_soc; |
| 508 | 508 | $this->status = $obj->status; |
| 509 | - $this->statut = $obj->status; // deprecated |
|
| 509 | + $this->statut = $obj->status; // deprecated |
|
| 510 | 510 | $this->duration = $obj->duree; |
| 511 | 511 | $this->datec = $this->db->jdate($obj->datec); |
| 512 | 512 | $this->dateo = $this->db->jdate($obj->dateo); |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | if (!$error) { |
| 703 | 703 | $this->ref = $num; |
| 704 | 704 | $this->status = self::STATUS_VALIDATED; |
| 705 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 705 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 706 | 706 | $this->date_validation = $now; |
| 707 | 707 | $this->db->commit(); |
| 708 | 708 | return 1; |
@@ -736,13 +736,13 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | $now = dol_now(); |
| 738 | 738 | |
| 739 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element; |
|
| 740 | - $sql .= ' SET fk_statut = ' . self::STATUS_CLOSED . ','; |
|
| 741 | - $sql .= " datet = '" . $this->db->idate($now) . "',"; |
|
| 742 | - $sql .= " fk_user_modif = " . ((int) $user->id); |
|
| 743 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 744 | - $sql .= " AND fk_statut > " . self::STATUS_DRAFT; |
|
| 745 | - $sql .= " AND entity = " . ((int) $conf->entity); |
|
| 739 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; |
|
| 740 | + $sql .= ' SET fk_statut = '.self::STATUS_CLOSED.','; |
|
| 741 | + $sql .= " datet = '".$this->db->idate($now)."',"; |
|
| 742 | + $sql .= " fk_user_modif = ".((int) $user->id); |
|
| 743 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 744 | + $sql .= " AND fk_statut > ".self::STATUS_DRAFT; |
|
| 745 | + $sql .= " AND entity = ".((int) $conf->entity); |
|
| 746 | 746 | |
| 747 | 747 | if ($this->db->query($sql)) { |
| 748 | 748 | if (!$notrigger) { |
@@ -1002,8 +1002,8 @@ discard block |
||
| 1002 | 1002 | if (getDolGlobalString('FICHEINTER_ADDON')) { |
| 1003 | 1003 | $mybool = false; |
| 1004 | 1004 | |
| 1005 | - $file = "mod_" . getDolGlobalString('FICHEINTER_ADDON').".php"; |
|
| 1006 | - $classname = "mod_" . getDolGlobalString('FICHEINTER_ADDON'); |
|
| 1005 | + $file = "mod_".getDolGlobalString('FICHEINTER_ADDON').".php"; |
|
| 1006 | + $classname = "mod_".getDolGlobalString('FICHEINTER_ADDON'); |
|
| 1007 | 1007 | |
| 1008 | 1008 | // Include file with class |
| 1009 | 1009 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | $this->id = 0; |
| 1332 | 1332 | $this->ref = ''; |
| 1333 | 1333 | $this->status = self::STATUS_DRAFT; |
| 1334 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 1334 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 1335 | 1335 | |
| 1336 | 1336 | // Clear fields |
| 1337 | 1337 | $this->user_author_id = $user->id; |
@@ -1403,7 +1403,7 @@ discard block |
||
| 1403 | 1403 | $line->fk_fichinter = $fichinterid; |
| 1404 | 1404 | $line->desc = $desc; |
| 1405 | 1405 | $line->date = $date_intervention; |
| 1406 | - $line->datei = $date_intervention; // For backward compatibility |
|
| 1406 | + $line->datei = $date_intervention; // For backward compatibility |
|
| 1407 | 1407 | $line->duration = $duration; |
| 1408 | 1408 | |
| 1409 | 1409 | if (is_array($array_options) && count($array_options) > 0) { |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | $line = new FichinterLigne($this->db); |
| 1456 | 1456 | $line->desc = $langs->trans("Description")." ".$xnbp; |
| 1457 | 1457 | $line->date = ($now - 3600 * (1 + $xnbp)); |
| 1458 | - $line->datei = ($now - 3600 * (1 + $xnbp)); // For backward compatibility |
|
| 1458 | + $line->datei = ($now - 3600 * (1 + $xnbp)); // For backward compatibility |
|
| 1459 | 1459 | $line->duration = 600; |
| 1460 | 1460 | $line->fk_fichinter = 0; |
| 1461 | 1461 | $this->lines[$xnbp] = $line; |
@@ -1500,7 +1500,7 @@ discard block |
||
| 1500 | 1500 | //For invoicing we calculing hours |
| 1501 | 1501 | $line->qty = round($objp->duree / 3600, 2); |
| 1502 | 1502 | $line->date = $this->db->jdate($objp->date); |
| 1503 | - $line->datei = $this->db->jdate($objp->date); // For backward compatibility |
|
| 1503 | + $line->datei = $this->db->jdate($objp->date); // For backward compatibility |
|
| 1504 | 1504 | $line->rang = $objp->rang; |
| 1505 | 1505 | $line->product_type = 1; |
| 1506 | 1506 | $line->fetch_optionals(); |
@@ -1666,19 +1666,19 @@ discard block |
||
| 1666 | 1666 | */ |
| 1667 | 1667 | public $fk_fichinter; |
| 1668 | 1668 | |
| 1669 | - public $desc; // Description ligne |
|
| 1669 | + public $desc; // Description ligne |
|
| 1670 | 1670 | |
| 1671 | 1671 | /** |
| 1672 | 1672 | * @var int Date of intervention |
| 1673 | 1673 | */ |
| 1674 | - public $date; // Date intervention |
|
| 1674 | + public $date; // Date intervention |
|
| 1675 | 1675 | /** |
| 1676 | 1676 | * @var int Date of intervention |
| 1677 | 1677 | * @deprecated |
| 1678 | 1678 | */ |
| 1679 | - public $datei; // Date intervention |
|
| 1679 | + public $datei; // Date intervention |
|
| 1680 | 1680 | |
| 1681 | - public $duration; // Duration of intervention |
|
| 1681 | + public $duration; // Duration of intervention |
|
| 1682 | 1682 | public $rang = 0; |
| 1683 | 1683 | public $tva_tx; |
| 1684 | 1684 | public $subprice; |
@@ -1728,10 +1728,10 @@ discard block |
||
| 1728 | 1728 | if ($resql) { |
| 1729 | 1729 | $objp = $this->db->fetch_object($resql); |
| 1730 | 1730 | $this->rowid = $objp->rowid; |
| 1731 | - $this->id = $objp->rowid; |
|
| 1731 | + $this->id = $objp->rowid; |
|
| 1732 | 1732 | $this->fk_fichinter = $objp->fk_fichinter; |
| 1733 | 1733 | $this->date = $this->db->jdate($objp->date); |
| 1734 | - $this->datei = $this->db->jdate($objp->date); // For backward compatibility |
|
| 1734 | + $this->datei = $this->db->jdate($objp->date); // For backward compatibility |
|
| 1735 | 1735 | $this->desc = $objp->description; |
| 1736 | 1736 | $this->duration = $objp->duree; |
| 1737 | 1737 | $this->rang = $objp->rang; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $usercanedit = $user->hasRight('website', 'write'); |
| 356 | -$permissiontoadd = $user->hasRight('website', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles |
|
| 356 | +$permissiontoadd = $user->hasRight('website', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles |
|
| 357 | 357 | $permissiontodelete = $user->hasRight('website', 'delete'); |
| 358 | 358 | |
| 359 | 359 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | if ($sortorder) { |
| 421 | 421 | $backtopage .= '&sortorder='.urlencode($sortorder); |
| 422 | 422 | } |
| 423 | -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file. |
|
| 423 | +include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file. |
|
| 424 | 424 | |
| 425 | 425 | $backtopage = $savbacktopage; |
| 426 | 426 | //var_dump($backtopage); |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | $content = ''; |
| 1184 | 1184 | if (GETPOSTISSET('content')) { |
| 1185 | 1185 | //$content = GETPOST('content', 'restricthtmlallowunvalid'); // @TODO Use a restricthtmlallowunvalidwithphp |
| 1186 | - $content = GETPOST('content', 'none'); // @TODO Use a restricthtmlallowunvalidwithphp |
|
| 1186 | + $content = GETPOST('content', 'none'); // @TODO Use a restricthtmlallowunvalidwithphp |
|
| 1187 | 1187 | |
| 1188 | 1188 | $objectpage->content = make_substitutions($content, $substitutionarray); |
| 1189 | 1189 | } else { |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | $error++; |
| 1557 | 1557 | setEventMessages($langs->trans('ErrorFaviconMustBeASquaredImage'), array(), 'errors'); |
| 1558 | 1558 | } |
| 1559 | - if (! $error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) { |
|
| 1559 | + if (!$error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) { |
|
| 1560 | 1560 | $error++; |
| 1561 | 1561 | setEventMessages($langs->trans('ErrorFaviconSize'), array(), 'errors'); |
| 1562 | 1562 | } |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | if (!GETPOSTISSET('updateandstay')) { // If we click on "Save And Stay", we don not make the redirect |
| 1569 | 1569 | $action = 'preview'; |
| 1570 | 1570 | if ($backtopage) { |
| 1571 | - $backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url |
|
| 1571 | + $backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url |
|
| 1572 | 1572 | header("Location: ".$backtopage); |
| 1573 | 1573 | exit; |
| 1574 | 1574 | } |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1602 | 1602 | |
| 1603 | 1603 | // Security analysis |
| 1604 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1604 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1605 | 1605 | |
| 1606 | 1606 | if (!$errorphpcheck) { |
| 1607 | 1607 | $htmlheadercontent = ''; |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1640 | 1640 | |
| 1641 | 1641 | // Security analysis |
| 1642 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1642 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1643 | 1643 | |
| 1644 | 1644 | if (!$errorphpcheck) { |
| 1645 | 1645 | $csscontent = ''; |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1683 | 1683 | |
| 1684 | 1684 | // Security analysis |
| 1685 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1685 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1686 | 1686 | |
| 1687 | 1687 | if (!$errorphpcheck) { |
| 1688 | 1688 | $jscontent = ''; |
@@ -1720,7 +1720,7 @@ discard block |
||
| 1720 | 1720 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1721 | 1721 | |
| 1722 | 1722 | // Security analysis |
| 1723 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1723 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1724 | 1724 | |
| 1725 | 1725 | if (!$errorphpcheck) { |
| 1726 | 1726 | $robotcontent = ''; |
@@ -1758,7 +1758,7 @@ discard block |
||
| 1758 | 1758 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1759 | 1759 | |
| 1760 | 1760 | // Security analysis |
| 1761 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1761 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1762 | 1762 | |
| 1763 | 1763 | if (!$errorphpcheck) { |
| 1764 | 1764 | $htaccesscontent = ''; |
@@ -1782,7 +1782,7 @@ discard block |
||
| 1782 | 1782 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1783 | 1783 | |
| 1784 | 1784 | // Security analysis |
| 1785 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1785 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1786 | 1786 | |
| 1787 | 1787 | if (!$errorphpcheck) { |
| 1788 | 1788 | $manifestjsoncontent = ''; |
@@ -1820,7 +1820,7 @@ discard block |
||
| 1820 | 1820 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1821 | 1821 | |
| 1822 | 1822 | // Security analysis |
| 1823 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1823 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1824 | 1824 | |
| 1825 | 1825 | if (!$errorphpcheck) { |
| 1826 | 1826 | $readmecontent = ''; |
@@ -1858,7 +1858,7 @@ discard block |
||
| 1858 | 1858 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); |
| 1859 | 1859 | |
| 1860 | 1860 | // Security analysis |
| 1861 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1861 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages |
|
| 1862 | 1862 | |
| 1863 | 1863 | if (!$errorphpcheck) { |
| 1864 | 1864 | $licensecontent = ''; |
@@ -1900,7 +1900,7 @@ discard block |
||
| 1900 | 1900 | if (!GETPOSTISSET('updateandstay')) { // If we click on "Save And Stay", we don not make the redirect |
| 1901 | 1901 | $action = 'preview'; |
| 1902 | 1902 | if ($backtopage) { |
| 1903 | - $backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url |
|
| 1903 | + $backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url |
|
| 1904 | 1904 | header("Location: ".$backtopage); |
| 1905 | 1905 | exit; |
| 1906 | 1906 | } |
@@ -1919,7 +1919,7 @@ discard block |
||
| 1919 | 1919 | |
| 1920 | 1920 | $object->fk_default_home = $pageid; |
| 1921 | 1921 | $res = $object->update($user); |
| 1922 | - if (! ($res > 0)) { |
|
| 1922 | + if (!($res > 0)) { |
|
| 1923 | 1923 | $error++; |
| 1924 | 1924 | setEventMessages($object->error, $object->errors, 'errors'); |
| 1925 | 1925 | } |
@@ -2310,7 +2310,7 @@ discard block |
||
| 2310 | 2310 | |
| 2311 | 2311 | $phpfullcodestringold = dolKeepOnlyPhpCode($objectpage->content); |
| 2312 | 2312 | |
| 2313 | - $objectpage->content = GETPOST('PAGE_CONTENT', 'none'); // any HTML content allowed |
|
| 2313 | + $objectpage->content = GETPOST('PAGE_CONTENT', 'none'); // any HTML content allowed |
|
| 2314 | 2314 | |
| 2315 | 2315 | $phpfullcodestring = dolKeepOnlyPhpCode($objectpage->content); |
| 2316 | 2316 | |
@@ -2531,7 +2531,7 @@ discard block |
||
| 2531 | 2531 | $fileofzip = ''; |
| 2532 | 2532 | if (GETPOSTISSET('templateuserfile')) { |
| 2533 | 2533 | // Case we selected one template |
| 2534 | - $fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); // $fileofzip will be sanitized later into the importWebSite() |
|
| 2534 | + $fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); // $fileofzip will be sanitized later into the importWebSite() |
|
| 2535 | 2535 | } elseif (!empty($_FILES) && is_array($_FILES['userfile'])) { |
| 2536 | 2536 | // Case we upload a new template |
| 2537 | 2537 | if (is_array($_FILES['userfile']['tmp_name'])) { |
@@ -2613,7 +2613,7 @@ discard block |
||
| 2613 | 2613 | if ($website->virtualhost) { |
| 2614 | 2614 | $domainname = $website->virtualhost; |
| 2615 | 2615 | } |
| 2616 | - if (! preg_match('/^http/i', $domainname)) { |
|
| 2616 | + if (!preg_match('/^http/i', $domainname)) { |
|
| 2617 | 2617 | $domainname = 'https://'.$domainname; |
| 2618 | 2618 | } |
| 2619 | 2619 | |
@@ -2679,7 +2679,7 @@ discard block |
||
| 2679 | 2679 | $url->appendChild($lastmod); |
| 2680 | 2680 | // Add suggested frequency for refresh |
| 2681 | 2681 | if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) { |
| 2682 | - $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values |
|
| 2682 | + $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values |
|
| 2683 | 2683 | $url->appendChild($changefreq); |
| 2684 | 2684 | } |
| 2685 | 2685 | // Add higher priority for home page |
@@ -2784,7 +2784,7 @@ discard block |
||
| 2784 | 2784 | $url->appendChild($lastmod); |
| 2785 | 2785 | // Add suggested frequency for refresh |
| 2786 | 2786 | if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) { |
| 2787 | - $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values |
|
| 2787 | + $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values |
|
| 2788 | 2788 | $url->appendChild($changefreq); |
| 2789 | 2789 | } |
| 2790 | 2790 | |
@@ -3072,11 +3072,11 @@ discard block |
||
| 3072 | 3072 | |
| 3073 | 3073 | // // Export web site |
| 3074 | 3074 | $extraCssClass = getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE') ? 'hideobject' : ''; |
| 3075 | - print '<input type="submit" class="button bordertransp ' . $extraCssClass . '" ' . $disabledexport . ' value="' . dol_escape_htmltag($exportlabel) . '" name="exportsite">'; |
|
| 3075 | + print '<input type="submit" class="button bordertransp '.$extraCssClass.'" '.$disabledexport.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">'; |
|
| 3076 | 3076 | |
| 3077 | 3077 | if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')) { |
| 3078 | 3078 | // Overwrite template in sources |
| 3079 | - $overwriteGitUrl = $_SERVER["PHP_SELF"] . '?action=overwritesite&website=' . urlencode($website->ref); |
|
| 3079 | + $overwriteGitUrl = $_SERVER["PHP_SELF"].'?action=overwritesite&website='.urlencode($website->ref); |
|
| 3080 | 3080 | print dolButtonToOpenExportDialog('exportpopup', $langs->trans('ExportOptions'), $langs->trans('ExportSite'), 'exportsite', $overwriteGitUrl); |
| 3081 | 3081 | //print '<a href="'.$_SERVER["PHP_SELF"].'?action=overwritesite&website='.urlencode($website->ref).'" class="button bordertransp hideobject" title="'.dol_escape_htmltag($langs->trans("ExportIntoGIT").". Directory ".getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')).'">'.dol_escape_htmltag($langs->trans("ExportIntoGIT")).'</a>'; |
| 3082 | 3082 | } |
@@ -3421,7 +3421,7 @@ discard block |
||
| 3421 | 3421 | print '<!-- button EditInLine and ShowSubcontainers -->'."\n"; |
| 3422 | 3422 | print '<div class="websiteselectionsection inline-block">'; |
| 3423 | 3423 | |
| 3424 | - print '<div class="inline-block marginrightonly">'; // Button includes dynamic content |
|
| 3424 | + print '<div class="inline-block marginrightonly">'; // Button includes dynamic content |
|
| 3425 | 3425 | print $langs->trans("ShowSubcontainers"); |
| 3426 | 3426 | if (!getDolGlobalString('WEBSITE_SUBCONTAINERSINLINE')) { |
| 3427 | 3427 | print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>'; |
@@ -3430,7 +3430,7 @@ discard block |
||
| 3430 | 3430 | } |
| 3431 | 3431 | print '</div>'; |
| 3432 | 3432 | |
| 3433 | - print '<div class="inline-block marginrightonly">'; // Button edit inline |
|
| 3433 | + print '<div class="inline-block marginrightonly">'; // Button edit inline |
|
| 3434 | 3434 | |
| 3435 | 3435 | print '<span id="switchckeditorinline">'."\n"; |
| 3436 | 3436 | // Enable CKEditor inline with js on section and div with conteneditable=true |
@@ -3522,15 +3522,15 @@ discard block |
||
| 3522 | 3522 | // Sending data via AJAX |
| 3523 | 3523 | $.ajax({ |
| 3524 | 3524 | type: \'POST\', |
| 3525 | - url: \'' . DOL_URL_ROOT . '/core/ajax/editinline.php\', |
|
| 3525 | + url: \'' . DOL_URL_ROOT.'/core/ajax/editinline.php\', |
|
| 3526 | 3526 | data: { |
| 3527 | 3527 | website_ref: \''.$website->ref.'\', |
| 3528 | - page_id: \'' . $websitepage->id . '\', |
|
| 3528 | + page_id: \'' . $websitepage->id.'\', |
|
| 3529 | 3529 | content: content, |
| 3530 | 3530 | element_id: elementId, |
| 3531 | 3531 | element_type: elementType, |
| 3532 | 3532 | action: \'updatedElementContent\', |
| 3533 | - token: \'' . newToken() . '\' |
|
| 3533 | + token: \'' . newToken().'\' |
|
| 3534 | 3534 | }, |
| 3535 | 3535 | success: function(response) { |
| 3536 | 3536 | console.log(response); |
@@ -3596,7 +3596,7 @@ discard block |
||
| 3596 | 3596 | } else { |
| 3597 | 3597 | $disabled = ''; |
| 3598 | 3598 | $title = ''; |
| 3599 | - $url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref); // action=delete for webpage, deletesite for website |
|
| 3599 | + $url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref); // action=delete for webpage, deletesite for website |
|
| 3600 | 3600 | } |
| 3601 | 3601 | print '<a href="'.$url.'" class="button buttonDelete bordertransp'.($disabled ? ' disabled' : '').'"'.$disabled.' title="'.dol_escape_htmltag($title).'">'.img_picto('', 'delete', 'class=""').'<span class="hideonsmartphone paddingleft">'.$langs->trans("Delete").'</span></a>'; |
| 3602 | 3602 | print '</span>'; |
@@ -3816,7 +3816,7 @@ discard block |
||
| 3816 | 3816 | // Clean the php htaccesscontent file to remove php code and get only html part |
| 3817 | 3817 | $htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htaccesscontent); |
| 3818 | 3818 | } else { |
| 3819 | - $htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml'); // We must use 'nohtml' and not 'alphanohtml' because we must accept " |
|
| 3819 | + $htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml'); // We must use 'nohtml' and not 'alphanohtml' because we must accept " |
|
| 3820 | 3820 | } |
| 3821 | 3821 | if (!trim($htaccesscontent)) { |
| 3822 | 3822 | $htaccesscontent .= "# Order allow,deny\n"; |
@@ -3918,7 +3918,7 @@ discard block |
||
| 3918 | 3918 | $maxfilesizearray = getMaxFileSizeArray(); |
| 3919 | 3919 | $maxmin = $maxfilesizearray['maxmin']; |
| 3920 | 3920 | if ($maxmin > 0) { |
| 3921 | - print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 3921 | + print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 3922 | 3922 | } |
| 3923 | 3923 | print '<input type="file" class="flat minwidth300" name="addedfile" id="addedfile"/>'; |
| 3924 | 3924 | |
@@ -4175,7 +4175,7 @@ discard block |
||
| 4175 | 4175 | $maxfilesizearray = getMaxFileSizeArray(); |
| 4176 | 4176 | $maxmin = $maxfilesizearray['maxmin']; |
| 4177 | 4177 | if ($maxmin > 0) { |
| 4178 | - print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 4178 | + print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 4179 | 4179 | } |
| 4180 | 4180 | print '<input class="flat minwidth400" type="file" name="userfile[]" accept=".zip">'; |
| 4181 | 4181 | print '<input type="submit" class="button small" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">'; |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | |
| 4784 | 4784 | |
| 4785 | 4785 | $module = 'medias'; |
| 4786 | - $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php |
|
| 4786 | + $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php |
|
| 4787 | 4787 | if (empty($url)) { |
| 4788 | 4788 | $url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param |
| 4789 | 4789 | } |
@@ -5019,8 +5019,8 @@ discard block |
||
| 5019 | 5019 | print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; |
| 5020 | 5020 | print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); |
| 5021 | 5021 | print getTitleFieldOfList("UserCreation", 0, $_SERVER['PHP_SELF'], 'fk_user_creat', '', $param, '', $sortfield, $sortorder, '')."\n"; |
| 5022 | - print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date creation |
|
| 5023 | - print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif |
|
| 5022 | + print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date creation |
|
| 5023 | + print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif |
|
| 5024 | 5024 | print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); |
| 5025 | 5025 | // Action column |
| 5026 | 5026 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $objectpage = new WebsitePage($db); |
| 67 | 67 | $res = $objectpage->fetch($page_id); |
| 68 | 68 | if (!$res) { |
| 69 | - print "Cannot find page with ID = " . $page_id . "."; |
|
| 69 | + print "Cannot find page with ID = ".$page_id."."; |
|
| 70 | 70 | exit; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $objectwebsite = new Website($db); |
| 75 | 75 | $res = $objectwebsite->fetch($objectpage->fk_website); |
| 76 | 76 | if (!$res) { |
| 77 | - print "Cannot find website with REF " . $objectpage->fk_website . "."; |
|
| 77 | + print "Cannot find website with REF ".$objectpage->fk_website."."; |
|
| 78 | 78 | exit; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $error = 0; |
| 83 | 83 | |
| 84 | 84 | // Replace element content into database and tpl file |
| 85 | - $objectpage->content = preg_replace('/<' . $element_type . '[^>]*id="' . $element_id . '"[^>]*>\K(.*?)(?=<\/' . $element_type . '>)/s', $content, $objectpage->content, 1); |
|
| 85 | + $objectpage->content = preg_replace('/<'.$element_type.'[^>]*id="'.$element_id.'"[^>]*>\K(.*?)(?=<\/'.$element_type.'>)/s', $content, $objectpage->content, 1); |
|
| 86 | 86 | $res = $objectpage->update($user); |
| 87 | 87 | if ($res) { |
| 88 | 88 | global $dolibarr_main_data_root; |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $result = dolSavePageContent($filetpl, $objectwebsite, $objectpage, 1); |
| 93 | 93 | if (!$result) { |
| 94 | - print "Failed to write file " . $filetpl . "."; |
|
| 94 | + print "Failed to write file ".$filetpl."."; |
|
| 95 | 95 | $error++; |
| 96 | 96 | } |
| 97 | 97 | } else { |
| 98 | - print "Failed to save changes error " . $objectpage->error . "."; |
|
| 98 | + print "Failed to save changes error ".$objectpage->error."."; |
|
| 99 | 99 | $error++; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (!$error) { |
| 103 | 103 | $db->commit(); |
| 104 | - print "Changes are saved for " . $element_type . " with id " . $element_id; |
|
| 104 | + print "Changes are saved for ".$element_type." with id ".$element_id; |
|
| 105 | 105 | } else { |
| 106 | 106 | $db->rollback(); |
| 107 | 107 | } |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | if (!defined('NOBROWSERNOTIF')) { |
| 49 | 49 | define('NOBROWSERNOTIF', '1'); |
| 50 | 50 | } |
| 51 | -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 51 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 52 | 52 | if (is_numeric($entity)) { |
| 53 | 53 | define("DOLENTITY", $entity); |
| 54 | 54 | } |
| 55 | 55 | include '../../main.inc.php'; |
| 56 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 56 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 57 | 57 | |
| 58 | 58 | $action = GETPOST('action', 'aZ09'); |
| 59 | 59 | |
| 60 | 60 | $signature = GETPOST('signaturebase64'); |
| 61 | 61 | $ref = GETPOST('ref', 'aZ09'); |
| 62 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 62 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 63 | 63 | $SECUREKEY = GETPOST("securekey"); // Secure key |
| 64 | 64 | $online_sign_name = GETPOST("onlinesignname"); |
| 65 | 65 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | $securekeyseed = getDolGlobalString(strtoupper($type).'_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 84 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
| 83 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 84 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -105,29 +105,29 @@ discard block |
||
| 105 | 105 | $data = base64_decode($signature); |
| 106 | 106 | |
| 107 | 107 | if ($mode == "propale" || $mode == 'proposal') { |
| 108 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 109 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 108 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 109 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 110 | 110 | $object = new Propal($db); |
| 111 | 111 | $object->fetch(0, $ref); |
| 112 | 112 | |
| 113 | 113 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity]) ? $conf->propal->multidir_output[$object->entity] : $conf->propal->dir_output; |
| 114 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 114 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 115 | 115 | |
| 116 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 117 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 116 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 117 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 118 | 118 | $langs->loadLangs(array("main", "companies")); |
| 119 | 119 | |
| 120 | 120 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 121 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 122 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 123 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 124 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 121 | + $filename = "signatures/".$date."_signature.png"; |
|
| 122 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 123 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 124 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 125 | 125 | $error++; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (!$error) { |
| 130 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 130 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 131 | 131 | if ($return == false) { |
| 132 | 132 | $error++; |
| 133 | 133 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | if (!$error) { |
| 138 | 138 | // Defined modele of doc |
| 139 | 139 | $last_main_doc_file = $object->last_main_doc; |
| 140 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 140 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 141 | 141 | |
| 142 | 142 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 143 | 143 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 144 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 145 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 144 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 145 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 146 | 146 | |
| 147 | 147 | if (dol_is_file($sourcefile)) { |
| 148 | 148 | // We build the new PDF |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | //$pdf->Open(); |
| 161 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 161 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 162 | 162 | |
| 163 | 163 | $param = array(); |
| 164 | 164 | $param['online_sign_name'] = $online_sign_name; |
| 165 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 165 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 166 | 166 | |
| 167 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 167 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 168 | 168 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 169 | 169 | try { |
| 170 | 170 | $tppl = $pdf->importPage($i); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | dolPrintSignatureImage($pdf, $langs, $param); |
| 184 | 184 | } |
| 185 | 185 | } catch (Exception $e) { |
| 186 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 186 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 187 | 187 | $response = $e->getMessage(); |
| 188 | 188 | $error++; |
| 189 | 189 | } |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $online_sign_ip = getUserRemoteIP(); |
| 222 | 222 | |
| 223 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
| 224 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
| 225 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 226 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 223 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
| 224 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
| 225 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 226 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 227 | 227 | if ($online_sign_name) { |
| 228 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 228 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 229 | 229 | } |
| 230 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 230 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 231 | 231 | |
| 232 | 232 | dol_syslog(__FILE__, LOG_DEBUG); |
| 233 | 233 | $resql = $db->query($sql); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
| 247 | 247 | if ($result < 0) { |
| 248 | 248 | $error++; |
| 249 | - $response = "error in trigger " . $object->error; |
|
| 249 | + $response = "error in trigger ".$object->error; |
|
| 250 | 250 | } else { |
| 251 | 251 | $response = "success"; |
| 252 | 252 | } |
@@ -267,25 +267,25 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | } elseif ($mode == 'contract') { |
| 270 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 271 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 270 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 271 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 272 | 272 | $object = new Contrat($db); |
| 273 | 273 | $object->fetch(0, $ref); |
| 274 | 274 | |
| 275 | 275 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity]) ? $conf->contrat->multidir_output[$object->entity] : $conf->contrat->dir_output; |
| 276 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 276 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 277 | 277 | |
| 278 | 278 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 279 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 280 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 281 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 282 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 279 | + $filename = "signatures/".$date."_signature.png"; |
|
| 280 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 281 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 282 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 283 | 283 | $error++; |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | if (!$error) { |
| 288 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 288 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 289 | 289 | if ($return == false) { |
| 290 | 290 | $error++; |
| 291 | 291 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -295,11 +295,11 @@ discard block |
||
| 295 | 295 | if (!$error) { |
| 296 | 296 | // Defined modele of doc |
| 297 | 297 | $last_main_doc_file = $object->last_main_doc; |
| 298 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 298 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 299 | 299 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 300 | 300 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 301 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 302 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 301 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 302 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 303 | 303 | |
| 304 | 304 | if (dol_is_file($sourcefile)) { |
| 305 | 305 | // We build the new PDF |
@@ -315,13 +315,13 @@ discard block |
||
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | //$pdf->Open(); |
| 318 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 318 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 319 | 319 | |
| 320 | 320 | $param = array(); |
| 321 | 321 | $param['online_sign_name'] = $online_sign_name; |
| 322 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 322 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 323 | 323 | |
| 324 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 324 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 325 | 325 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 326 | 326 | try { |
| 327 | 327 | $tppl = $pdf->importPage($i); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | dolPrintSignatureImage($pdf, $langs, $param); |
| 341 | 341 | } |
| 342 | 342 | } catch (Exception $e) { |
| 343 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 343 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 344 | 344 | $response = $e->getMessage(); |
| 345 | 345 | $error++; |
| 346 | 346 | } |
@@ -375,8 +375,8 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } elseif ($mode == 'fichinter') { |
| 378 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 379 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 378 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 379 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 380 | 380 | $object = new Fichinter($db); |
| 381 | 381 | $object->fetch(0, $ref); |
| 382 | 382 | |
@@ -385,20 +385,20 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | $langs->loadLangs(array("main", "companies")); |
| 387 | 387 | |
| 388 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 389 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 388 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 389 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 390 | 390 | |
| 391 | 391 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 392 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 393 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 394 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 395 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 392 | + $filename = "signatures/".$date."_signature.png"; |
|
| 393 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 394 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 395 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 396 | 396 | $error++; |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | if (!$error) { |
| 401 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 401 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 402 | 402 | if ($return == false) { |
| 403 | 403 | $error++; |
| 404 | 404 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -408,11 +408,11 @@ discard block |
||
| 408 | 408 | if (!$error) { |
| 409 | 409 | // Defined modele of doc |
| 410 | 410 | $last_main_doc_file = $object->last_main_doc; |
| 411 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 411 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 412 | 412 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 413 | 413 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 414 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 415 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 414 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 415 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 416 | 416 | |
| 417 | 417 | if (dol_is_file($sourcefile)) { |
| 418 | 418 | // We build the new PDF |
@@ -428,13 +428,13 @@ discard block |
||
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | //$pdf->Open(); |
| 431 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 431 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 432 | 432 | |
| 433 | 433 | $param = array(); |
| 434 | 434 | $param['online_sign_name'] = $online_sign_name; |
| 435 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 435 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 436 | 436 | |
| 437 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 437 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 438 | 438 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 439 | 439 | try { |
| 440 | 440 | $tppl = $pdf->importPage($i); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | dolPrintSignatureImage($pdf, $langs, $param); |
| 454 | 454 | } |
| 455 | 455 | } catch (Exception $e) { |
| 456 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 456 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 457 | 457 | $response = $e->getMessage(); |
| 458 | 458 | $error++; |
| 459 | 459 | } |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | } elseif ($mode == "societe_rib") { |
| 491 | 491 | $langs->load('withdrawals'); |
| 492 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 493 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 492 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 493 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 494 | 494 | $modelpath = "core/modules/bank/doc/"; |
| 495 | 495 | $object = new CompanyBankAccount($db); |
| 496 | 496 | $object->fetch(0, $ref); |
@@ -498,23 +498,23 @@ discard block |
||
| 498 | 498 | $object->fetch_thirdparty(); |
| 499 | 499 | |
| 500 | 500 | |
| 501 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' . dol_sanitizeFileName($object->thirdparty->id) . '/'; |
|
| 501 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/'.dol_sanitizeFileName($object->thirdparty->id).'/'; |
|
| 502 | 502 | |
| 503 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 504 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 503 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 504 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 505 | 505 | $langs->loadLangs(array("main", "companies")); |
| 506 | 506 | |
| 507 | 507 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 508 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 509 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 510 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 511 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 508 | + $filename = "signatures/".$date."_signature.png"; |
|
| 509 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 510 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 511 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 512 | 512 | $error++; |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | if (!$error) { |
| 517 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 517 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 518 | 518 | if ($return == false) { |
| 519 | 519 | $error++; |
| 520 | 520 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -525,14 +525,14 @@ discard block |
||
| 525 | 525 | // Defined modele of doc |
| 526 | 526 | $last_main_doc_file = $object->last_main_doc; |
| 527 | 527 | $last_modelpdf = $object->model_pdf; |
| 528 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 528 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 529 | 529 | |
| 530 | 530 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 531 | 531 | $sourcefile = ''; |
| 532 | 532 | $newpdffilename = ''; |
| 533 | 533 | if ($last_modelpdf == 'sepamandate') { |
| 534 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
| 535 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
| 534 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
| 535 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
| 536 | 536 | } |
| 537 | 537 | if (dol_is_file($sourcefile)) { |
| 538 | 538 | // We build the new PDF |
@@ -548,9 +548,9 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | //$pdf->Open(); |
| 551 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 551 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 552 | 552 | |
| 553 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 553 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 554 | 554 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 555 | 555 | try { |
| 556 | 556 | $tppl = $pdf->importPage($i); |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 559 | 559 | $pdf->useTemplate($tppl); |
| 560 | 560 | } catch (Exception $e) { |
| 561 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 561 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 562 | 562 | $response = $e->getMessage(); |
| 563 | 563 | $error++; |
| 564 | 564 | } |
@@ -574,18 +574,18 @@ discard block |
||
| 574 | 574 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
| 575 | 575 | } |
| 576 | 576 | foreach ($dirmodels as $reldir) { |
| 577 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
| 577 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
| 578 | 578 | // On vérifie l'emplacement du modele |
| 579 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
| 579 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
| 580 | 580 | if (file_exists($file)) { |
| 581 | 581 | $filefound = $file; |
| 582 | - $classname = 'pdf_' . $last_modelpdf; |
|
| 582 | + $classname = 'pdf_'.$last_modelpdf; |
|
| 583 | 583 | break; |
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | if ($filefound === '') { |
| 588 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
| 588 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
| 589 | 589 | dol_syslog($response, LOG_ERR); |
| 590 | 590 | $error++; |
| 591 | 591 | } |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | $param = array(); |
| 611 | 611 | $param['online_sign_name'] = $online_sign_name; |
| 612 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 612 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 613 | 613 | |
| 614 | 614 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
| 615 | 615 | // TODO Get position of box from PDF template |
@@ -644,16 +644,16 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | $online_sign_ip = getUserRemoteIP(); |
| 646 | 646 | |
| 647 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
| 647 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
| 648 | 648 | $sql .= " SET "; |
| 649 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 650 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 649 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 650 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 651 | 651 | if ($online_sign_name) { |
| 652 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 652 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 653 | 653 | } |
| 654 | 654 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
| 655 | 655 | |
| 656 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 656 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 657 | 657 | |
| 658 | 658 | dol_syslog(__FILE__, LOG_DEBUG); |
| 659 | 659 | $resql = $db->query($sql); |
@@ -679,8 +679,8 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | } elseif ($mode == 'expedition') { |
| 682 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 683 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 682 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 683 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 684 | 684 | |
| 685 | 685 | $object = new Expedition($db); |
| 686 | 686 | $object->fetch(0, $ref); |
@@ -690,20 +690,20 @@ discard block |
||
| 690 | 690 | |
| 691 | 691 | $langs->loadLangs(array("main", "companies")); |
| 692 | 692 | |
| 693 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 694 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 693 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 694 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 695 | 695 | |
| 696 | 696 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 697 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 698 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 699 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 700 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 697 | + $filename = "signatures/".$date."_signature.png"; |
|
| 698 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 699 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 700 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 701 | 701 | $error++; |
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if (!$error) { |
| 706 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 706 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 707 | 707 | if ($return == false) { |
| 708 | 708 | $error++; |
| 709 | 709 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -716,15 +716,15 @@ discard block |
||
| 716 | 716 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 717 | 717 | // It seems document has never been generated, or was generated and then deleted. |
| 718 | 718 | // So we try to regenerate it with its default template. |
| 719 | - $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. |
|
| 719 | + $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. |
|
| 720 | 720 | $object->generateDocument($defaulttemplate, $langs); |
| 721 | 721 | } |
| 722 | 722 | $last_main_doc_file = $object->last_main_doc; |
| 723 | - $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 723 | + $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 724 | 724 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 725 | 725 | // TODO Use the $last_main_doc_file to defined the $newpdffilename and $sourcefile |
| 726 | - $newpdffilename = $upload_dir . $ref . "_signed-" . $date . ".pdf"; |
|
| 727 | - $sourcefile = $upload_dir . $ref . ".pdf"; |
|
| 726 | + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; |
|
| 727 | + $sourcefile = $upload_dir.$ref.".pdf"; |
|
| 728 | 728 | |
| 729 | 729 | |
| 730 | 730 | if (dol_is_file($sourcefile)) { |
@@ -741,13 +741,13 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | //$pdf->Open(); |
| 744 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 744 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 745 | 745 | |
| 746 | 746 | $param = array(); |
| 747 | 747 | $param['online_sign_name'] = $online_sign_name; |
| 748 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 748 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 749 | 749 | |
| 750 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 750 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 751 | 751 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 752 | 752 | try { |
| 753 | 753 | $tppl = $pdf->importPage($i); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | dolPrintSignatureImage($pdf, $langs, $param); |
| 767 | 767 | } |
| 768 | 768 | } catch (Exception $e) { |
| 769 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 769 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 770 | 770 | $response = $e->getMessage(); |
| 771 | 771 | $error++; |
| 772 | 772 | } |
@@ -804,9 +804,9 @@ discard block |
||
| 804 | 804 | if (!$error) { |
| 805 | 805 | $db->begin(); |
| 806 | 806 | |
| 807 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "expedition"; |
|
| 808 | - $sql .= " SET signed_status = " . ((int) $object::STATUS_SIGNED) ; |
|
| 809 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 807 | + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; |
|
| 808 | + $sql .= " SET signed_status = ".((int) $object::STATUS_SIGNED); |
|
| 809 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 810 | 810 | |
| 811 | 811 | dol_syslog(__FILE__, LOG_DEBUG); |
| 812 | 812 | $resql = $db->query($sql); |
@@ -848,8 +848,8 @@ discard block |
||
| 848 | 848 | */ |
| 849 | 849 | function dolPrintSignatureImage(TCPDF $pdf, $langs, $params) |
| 850 | 850 | { |
| 851 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 852 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 851 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 852 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 853 | 853 | $xforimgstart = $params['xforimgstart']; |
| 854 | 854 | $yforimgstart = $params['yforimgstart']; |
| 855 | 855 | $wforimg = $params['wforimg']; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
| 858 | 858 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
| 859 | 859 | $pdf->SetTextColor(80, 80, 80); |
| 860 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Signature") . ': ' . dol_print_date(dol_now(), "day", false, $langs, true). ' - '.$params['online_sign_name'], 0, 'L'); |
|
| 860 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Signature").': '.dol_print_date(dol_now(), "day", false, $langs, true).' - '.$params['online_sign_name'], 0, 'L'); |
|
| 861 | 861 | //$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 862 | 862 | //$pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
| 863 | 863 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * No signature |
| 270 | 270 | */ |
| 271 | - const STATUS_NO_SIGNATURE = 0; |
|
| 271 | + const STATUS_NO_SIGNATURE = 0; |
|
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | 274 | * Signed status |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | if (getDolGlobalString('EXPEDITION_ADDON_NUMBER')) { |
| 321 | 321 | $mybool = false; |
| 322 | 322 | |
| 323 | - $file = getDolGlobalString('EXPEDITION_ADDON_NUMBER') . ".php"; |
|
| 323 | + $file = getDolGlobalString('EXPEDITION_ADDON_NUMBER').".php"; |
|
| 324 | 324 | $classname = getDolGlobalString('EXPEDITION_ADDON_NUMBER'); |
| 325 | 325 | |
| 326 | 326 | // Include file with class |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | // If product need a batch number, we should not have called this function but addline_batch instead. |
| 993 | 993 | // If this happen, we may have a bug in card.php page |
| 994 | 994 | if (isModEnabled('productbatch') && !empty($orderline->fk_product) && !empty($orderline->product_tobatch)) { |
| 995 | - $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$orderline->fk_product; // |
|
| 995 | + $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$orderline->fk_product; // |
|
| 996 | 996 | return -4; |
| 997 | 997 | } |
| 998 | 998 | |
@@ -1562,8 +1562,8 @@ discard block |
||
| 1562 | 1562 | $this->db->commit(); |
| 1563 | 1563 | |
| 1564 | 1564 | // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive |
| 1565 | - $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 1566 | - $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 1565 | + $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 1566 | + $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
| 1567 | 1567 | |
| 1568 | 1568 | // We delete PDFs |
| 1569 | 1569 | $ref = dol_sanitizeFileName($this->ref); |
@@ -1636,7 +1636,7 @@ discard block |
||
| 1636 | 1636 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; |
| 1637 | 1637 | $sql .= " WHERE ed.fk_expedition = ".((int) $this->id); |
| 1638 | 1638 | $sql .= " AND ed.fk_elementdet = cd.rowid"; |
| 1639 | - $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
| 1639 | + $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
| 1640 | 1640 | |
| 1641 | 1641 | dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); |
| 1642 | 1642 | $resql = $this->db->query($sql); |
@@ -1665,13 +1665,13 @@ discard block |
||
| 1665 | 1665 | |
| 1666 | 1666 | |
| 1667 | 1667 | if ($originline > 0 && $originline == $obj->fk_elementdet) { |
| 1668 | - '@phan-var-force ExpeditionLigne $line'; // $line from previous loop |
|
| 1668 | + '@phan-var-force ExpeditionLigne $line'; // $line from previous loop |
|
| 1669 | 1669 | $line->entrepot_id = 0; // entrepod_id in details_entrepot |
| 1670 | 1670 | $line->qty_shipped += $obj->qty_shipped; |
| 1671 | 1671 | } else { |
| 1672 | - $line = new ExpeditionLigne($this->db); // new group to start |
|
| 1673 | - $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
| 1674 | - $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
| 1672 | + $line = new ExpeditionLigne($this->db); // new group to start |
|
| 1673 | + $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
| 1674 | + $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | 1677 | $detail_entrepot = new stdClass(); |
@@ -1684,13 +1684,13 @@ discard block |
||
| 1684 | 1684 | $line->rowid = $obj->line_id; // TODO deprecated |
| 1685 | 1685 | $line->id = $obj->line_id; |
| 1686 | 1686 | |
| 1687 | - $line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line |
|
| 1687 | + $line->fk_origin = 'orderline'; // TODO deprecated, we already have element_type that can be use to guess type of line |
|
| 1688 | 1688 | |
| 1689 | - $line->fk_element = $obj->fk_element; |
|
| 1690 | - $line->origin_id = $obj->fk_element; |
|
| 1691 | - $line->fk_elementdet = $obj->fk_elementdet; |
|
| 1692 | - $line->origin_line_id = $obj->fk_elementdet; |
|
| 1693 | - $line->element_type = $obj->element_type; |
|
| 1689 | + $line->fk_element = $obj->fk_element; |
|
| 1690 | + $line->origin_id = $obj->fk_element; |
|
| 1691 | + $line->fk_elementdet = $obj->fk_elementdet; |
|
| 1692 | + $line->origin_line_id = $obj->fk_elementdet; |
|
| 1693 | + $line->element_type = $obj->element_type; |
|
| 1694 | 1694 | |
| 1695 | 1695 | $line->fk_expedition = $this->id; // id of parent |
| 1696 | 1696 | |
@@ -1700,8 +1700,8 @@ discard block |
||
| 1700 | 1700 | $line->ref = $obj->product_ref; // TODO deprecated |
| 1701 | 1701 | $line->product_ref = $obj->product_ref; |
| 1702 | 1702 | $line->product_label = $obj->product_label; |
| 1703 | - $line->libelle = $obj->product_label; // TODO deprecated |
|
| 1704 | - $line->product_barcode = $obj->product_barcode; // Barcode number product |
|
| 1703 | + $line->libelle = $obj->product_label; // TODO deprecated |
|
| 1704 | + $line->product_barcode = $obj->product_barcode; // Barcode number product |
|
| 1705 | 1705 | $line->product_tosell = $obj->product_tosell; |
| 1706 | 1706 | $line->product_tobuy = $obj->product_tobuy; |
| 1707 | 1707 | $line->product_tobatch = $obj->product_tobatch; |
@@ -1947,7 +1947,7 @@ discard block |
||
| 1947 | 1947 | } |
| 1948 | 1948 | $result .= $linkend; |
| 1949 | 1949 | global $action; |
| 1950 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1950 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1951 | 1951 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1952 | 1952 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1953 | 1953 | if ($reshook > 0) { |
@@ -2277,12 +2277,12 @@ discard block |
||
| 2277 | 2277 | if ($shipments_match_order) { |
| 2278 | 2278 | dol_syslog("Qty for the ".count($order->lines)." lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order'); |
| 2279 | 2279 | // We close the order |
| 2280 | - $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
| 2280 | + $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
| 2281 | 2281 | } |
| 2282 | 2282 | } |
| 2283 | 2283 | |
| 2284 | - $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2285 | - $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2284 | + $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2285 | + $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
| 2286 | 2286 | |
| 2287 | 2287 | // If stock increment is done on closing |
| 2288 | 2288 | if (!$error && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { |
@@ -2331,7 +2331,7 @@ discard block |
||
| 2331 | 2331 | |
| 2332 | 2332 | $error = 0; |
| 2333 | 2333 | |
| 2334 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; |
|
| 2334 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; |
|
| 2335 | 2335 | |
| 2336 | 2336 | $langs->load("agenda"); |
| 2337 | 2337 | |
@@ -2341,14 +2341,14 @@ discard block |
||
| 2341 | 2341 | $sql .= " e.ref,"; |
| 2342 | 2342 | $sql .= " edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock,"; |
| 2343 | 2343 | $sql .= " cd.rowid as cdid, ed.rowid as edid"; |
| 2344 | - $sql .= " FROM " . MAIN_DB_PREFIX . "commandedet as cd,"; |
|
| 2345 | - $sql .= " " . MAIN_DB_PREFIX . "expeditiondet as ed"; |
|
| 2346 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
|
| 2347 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expedition as e ON ed.fk_expedition = e.rowid"; |
|
| 2348 | - $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
| 2344 | + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd,"; |
|
| 2345 | + $sql .= " ".MAIN_DB_PREFIX."expeditiondet as ed"; |
|
| 2346 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
|
| 2347 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expedition as e ON ed.fk_expedition = e.rowid"; |
|
| 2348 | + $sql .= " WHERE ed.fk_expedition = ".((int) $this->id); |
|
| 2349 | 2349 | $sql .= " AND cd.rowid = ed.fk_elementdet"; |
| 2350 | 2350 | |
| 2351 | - dol_syslog(get_class($this) . "::valid select details", LOG_DEBUG); |
|
| 2351 | + dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); |
|
| 2352 | 2352 | $resql = $this->db->query($sql); |
| 2353 | 2353 | if ($resql) { |
| 2354 | 2354 | $cpt = $this->db->num_rows($resql); |
@@ -2362,7 +2362,7 @@ discard block |
||
| 2362 | 2362 | if ($qty <= 0 || ($qty < 0 && !getDolGlobalInt('SHIPMENT_ALLOW_NEGATIVE_QTY'))) { |
| 2363 | 2363 | continue; |
| 2364 | 2364 | } |
| 2365 | - dol_syslog(get_class($this) . "::valid movement index " . $i . " ed.rowid=" . $obj->rowid . " edb.rowid=" . $obj->edbrowid); |
|
| 2365 | + dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); |
|
| 2366 | 2366 | |
| 2367 | 2367 | $mouvS = new MouvementStock($this->db); |
| 2368 | 2368 | $mouvS->origin = &$this; |
@@ -2657,7 +2657,7 @@ discard block |
||
| 2657 | 2657 | * @var int |
| 2658 | 2658 | * @deprecated |
| 2659 | 2659 | */ |
| 2660 | - public $line_id; // deprecated |
|
| 2660 | + public $line_id; // deprecated |
|
| 2661 | 2661 | |
| 2662 | 2662 | /** |
| 2663 | 2663 | * @var int ID Duplicate of origin_id (using origin_id is better) |
@@ -2691,7 +2691,7 @@ discard block |
||
| 2691 | 2691 | * @var string |
| 2692 | 2692 | * @deprecated Use instead origin_type = element_type to guess the line of origin of the shipment line. |
| 2693 | 2693 | */ |
| 2694 | - public $fk_origin; // Example: 'orderline' |
|
| 2694 | + public $fk_origin; // Example: 'orderline' |
|
| 2695 | 2695 | |
| 2696 | 2696 | /** |
| 2697 | 2697 | * @var int Id of shipment |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $form = new Form($db); |
| 224 | 224 | $head = ''; |
| 225 | 225 | if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { |
| 226 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 226 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $conf->dol_hide_topmenu = 1; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | if ($source == 'proposal' && getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN')) { |
| 300 | 300 | print '<div class="backimagepublicproposalsign">'; |
| 301 | - print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">'; |
|
| 301 | + print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">'; |
|
| 302 | 302 | print '</div>'; |
| 303 | 303 | } |
| 304 | 304 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) { |
| 310 | 310 | $text .= $langs->trans($reg[1])."<br>\n"; |
| 311 | 311 | } else { |
| 312 | - $text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT') . "<br>\n"; |
|
| 312 | + $text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT')."<br>\n"; |
|
| 313 | 313 | } |
| 314 | 314 | $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 315 | 315 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 405 | 405 | // It seems document has never been generated, or was generated and then deleted. |
| 406 | 406 | // So we try to regenerate it with its default template. |
| 407 | - $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. |
|
| 407 | + $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. |
|
| 408 | 408 | $object->generateDocument($defaulttemplate, $langs); |
| 409 | 409 | } |
| 410 | 410 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 476 | 476 | // It seems document has never been generated, or was generated and then deleted. |
| 477 | 477 | // So we try to regenerate it with its default template. |
| 478 | - $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. |
|
| 478 | + $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. |
|
| 479 | 479 | $object->generateDocument($defaulttemplate, $langs); |
| 480 | 480 | } |
| 481 | 481 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 527 | 527 | // It seems document has never been generated, or was generated and then deleted. |
| 528 | 528 | // So we try to regenerate it with its default template. |
| 529 | - $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. |
|
| 529 | + $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. |
|
| 530 | 530 | $object->generateDocument($defaulttemplate, $langs); |
| 531 | 531 | } |
| 532 | 532 | |
@@ -550,24 +550,24 @@ discard block |
||
| 550 | 550 | $result = $object->fetch_thirdparty(); |
| 551 | 551 | |
| 552 | 552 | // Proposer |
| 553 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Proposer"); |
|
| 553 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer"); |
|
| 554 | 554 | print '</td><td class="CTableRow2">'; |
| 555 | 555 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
| 556 | - print '<b>' . $creditor . '</b>'; |
|
| 557 | - print '<input type="hidden" name="creditor" value="' . $creditor . '">'; |
|
| 558 | - print '</td></tr>' . "\n"; |
|
| 556 | + print '<b>'.$creditor.'</b>'; |
|
| 557 | + print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
|
| 558 | + print '</td></tr>'."\n"; |
|
| 559 | 559 | |
| 560 | 560 | // Target |
| 561 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("ThirdParty"); |
|
| 561 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty"); |
|
| 562 | 562 | print '</td><td class="CTableRow2">'; |
| 563 | 563 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
| 564 | - print '<b>' . $object->thirdparty->name . '</b>'; |
|
| 565 | - print '</td></tr>' . "\n"; |
|
| 564 | + print '<b>'.$object->thirdparty->name.'</b>'; |
|
| 565 | + print '</td></tr>'."\n"; |
|
| 566 | 566 | |
| 567 | 567 | // Object |
| 568 | - $text = '<b>' . $langs->trans("Signature" . dol_ucfirst($source) . "Ref", $object->ref) . '</b>'; |
|
| 569 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Designation"); |
|
| 570 | - print '</td><td class="CTableRow2">' . $text; |
|
| 568 | + $text = '<b>'.$langs->trans("Signature".dol_ucfirst($source)."Ref", $object->ref).'</b>'; |
|
| 569 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation"); |
|
| 570 | + print '</td><td class="CTableRow2">'.$text; |
|
| 571 | 571 | |
| 572 | 572 | $last_main_doc_file = $object->last_main_doc; |
| 573 | 573 | $diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].'/' |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 631 | 631 | // It seems document has never been generated, or was generated and then deleted. |
| 632 | 632 | // So we try to regenerate it with its default template. |
| 633 | - $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. |
|
| 633 | + $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. |
|
| 634 | 634 | $object->generateDocument($defaulttemplate, $langs); |
| 635 | 635 | } |
| 636 | 636 | $directdownloadlink = $object->getLastMainDocLink('', 0, 0); |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 680 | 680 | // It seems document has never been generated, or was generated and then deleted. |
| 681 | 681 | // So we try to regenerate it with its default template. |
| 682 | - $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. |
|
| 682 | + $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. |
|
| 683 | 683 | $object->generateDocument($defaulttemplate, $langs); |
| 684 | 684 | } |
| 685 | 685 | |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public $fk_user_approve; |
| 246 | 246 | |
| 247 | - public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) |
|
| 248 | - public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) |
|
| 247 | + public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) |
|
| 248 | + public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * Draft status |
@@ -336,8 +336,8 @@ discard block |
||
| 336 | 336 | $this->total_tva = 0; |
| 337 | 337 | $this->total_localtax1 = 0; |
| 338 | 338 | $this->total_localtax2 = 0; |
| 339 | - $this->localtax1 = 0; // For backward compatibility |
|
| 340 | - $this->localtax2 = 0; // For backward compatibility |
|
| 339 | + $this->localtax1 = 0; // For backward compatibility |
|
| 340 | + $this->localtax2 = 0; // For backward compatibility |
|
| 341 | 341 | $this->modepaymentid = 0; |
| 342 | 342 | |
| 343 | 343 | // List of language codes for status |
@@ -694,8 +694,8 @@ discard block |
||
| 694 | 694 | $this->total_ht = $obj->total_ht; |
| 695 | 695 | $this->total_tva = $obj->total_tva; |
| 696 | 696 | $this->total_ttc = $obj->total_ttc; |
| 697 | - $this->localtax1 = $obj->total_localtax1; // For backward compatibility |
|
| 698 | - $this->localtax2 = $obj->total_localtax2; // For backward compatibility |
|
| 697 | + $this->localtax1 = $obj->total_localtax1; // For backward compatibility |
|
| 698 | + $this->localtax2 = $obj->total_localtax2; // For backward compatibility |
|
| 699 | 699 | $this->total_localtax1 = $obj->total_localtax1; |
| 700 | 700 | $this->total_localtax2 = $obj->total_localtax2; |
| 701 | 701 | |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | |
| 1163 | 1163 | $deplig->rule_warning_message = $objp->rule_warning_message; |
| 1164 | 1164 | |
| 1165 | - $deplig->rang = $objp->rang; |
|
| 1165 | + $deplig->rang = $objp->rang; |
|
| 1166 | 1166 | |
| 1167 | 1167 | $this->lines[$i] = $deplig; |
| 1168 | 1168 | |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | if (getDolGlobalString('EXPENSEREPORT_ADDON')) { |
| 1711 | 1711 | $mybool = false; |
| 1712 | 1712 | |
| 1713 | - $file = getDolGlobalString('EXPENSEREPORT_ADDON') . ".php"; |
|
| 1713 | + $file = getDolGlobalString('EXPENSEREPORT_ADDON').".php"; |
|
| 1714 | 1714 | $classname = getDolGlobalString('EXPENSEREPORT_ADDON'); |
| 1715 | 1715 | |
| 1716 | 1716 | // Include file with class |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | $result .= $linkend; |
| 1866 | 1866 | |
| 1867 | 1867 | global $action; |
| 1868 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1868 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1869 | 1869 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1870 | 1870 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1871 | 1871 | if ($reshook > 0) { |
@@ -1958,8 +1958,8 @@ discard block |
||
| 1958 | 1958 | $this->line = new ExpenseReportLine($this->db); |
| 1959 | 1959 | |
| 1960 | 1960 | // We don't know seller and buyer for expense reports |
| 1961 | - $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 1962 | - $seller->tva_assuj = 1; // Most seller uses vat |
|
| 1961 | + $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 1962 | + $seller->tva_assuj = 1; // Most seller uses vat |
|
| 1963 | 1963 | $buyer = new Societe($this->db); |
| 1964 | 1964 | |
| 1965 | 1965 | $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); |
@@ -2041,8 +2041,8 @@ discard block |
||
| 2041 | 2041 | |
| 2042 | 2042 | // We don't know seller and buyer for expense reports |
| 2043 | 2043 | if (!is_object($seller)) { |
| 2044 | - $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2045 | - $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2044 | + $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2045 | + $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | 2048 | $expensereportrule = new ExpenseReportRule($db); |
@@ -2126,8 +2126,8 @@ discard block |
||
| 2126 | 2126 | |
| 2127 | 2127 | // We don't know seller and buyer for expense reports |
| 2128 | 2128 | if (!is_object($seller)) { |
| 2129 | - $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2130 | - $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2129 | + $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2130 | + $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2131 | 2131 | } |
| 2132 | 2132 | |
| 2133 | 2133 | $expenseik = new ExpenseReportIk($this->db); |
@@ -2221,10 +2221,10 @@ discard block |
||
| 2221 | 2221 | $type = 0; // TODO What if type is service ? |
| 2222 | 2222 | |
| 2223 | 2223 | // We don't know seller and buyer for expense reports |
| 2224 | - $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2225 | - $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2226 | - $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company |
|
| 2227 | - $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company |
|
| 2224 | + $seller = $mysoc; // We use same than current company (expense report are often done in same country) |
|
| 2225 | + $seller->tva_assuj = 1; // Most seller uses vat |
|
| 2226 | + $seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company |
|
| 2227 | + $seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company |
|
| 2228 | 2228 | $buyer = new Societe($this->db); |
| 2229 | 2229 | |
| 2230 | 2230 | $localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller); |
@@ -3158,7 +3158,7 @@ discard block |
||
| 3158 | 3158 | } elseif ($mode == 'mon' || $mode == 'EX_MON') { |
| 3159 | 3159 | $sql .= " AND DATE_FORMAT(d.date, '%Y-%m') = '".dol_print_date($this->date, '%Y-%m')."'"; // @todo DATE_FORMAT is forbidden |
| 3160 | 3160 | } elseif ($mode == 'year' || $mode == 'EX_YEA') { |
| 3161 | - $sql .= " AND DATE_FORMAT(d.date, '%Y') = '".dol_print_date($this->date, '%Y')."'"; // @todo DATE_FORMAT is forbidden |
|
| 3161 | + $sql .= " AND DATE_FORMAT(d.date, '%Y') = '".dol_print_date($this->date, '%Y')."'"; // @todo DATE_FORMAT is forbidden |
|
| 3162 | 3162 | } |
| 3163 | 3163 | |
| 3164 | 3164 | dol_syslog('ExpenseReportLine::getExpAmount'); |