diff --git a/build/pad/README b/build/pad/README index 3cbc171686c..241d27d01c2 100644 --- a/build/pad/README +++ b/build/pad/README @@ -1,6 +1,7 @@ README (English) ################################################## Building PAD files +http://pad.asp-software.org/padgen.php ################################################## This directory contains files and docs used to build diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 8b6a9888db0..b5bacf59356 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); +return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); } sub script_dolibarr_release @@ -400,6 +400,8 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", + $ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" : diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index dc23cff5486..27130244d00 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -166,7 +166,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index a446a7bd5d6..aeddd5526f8 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -247,7 +247,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 78d90080258..a1e4dffc781 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -163,7 +163,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index edae0126653..aed2d76ed29 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -174,7 +174,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d4a9b725524..204988c5442 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -111,6 +111,10 @@ with // DOL CHANGE If we keep this, the image is not visible on pages after the first one. //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); //return false; + $tfile = str_replace(' ', '%20', $file); + if (@TCPDF_STATIC::file_exists($tfile)) { + $file = $tfile; + } } * Replace in tcpdf.php diff --git a/dev/examples/code/README b/dev/examples/code/README index b7c31558de5..bf3dd3f4969 100644 --- a/dev/examples/code/README +++ b/dev/examples/code/README @@ -5,4 +5,4 @@ This directory contains samples of code to use Dolibarr business classes to buil external interfaces that need to read/update data from/into Dolibarr. You can also have a look at the Dolibarr doxygen doc that describes all files and classes: -http://www.dolibarr.org/html_doxygen/index.html +https://doxygen.dolibarr.org/ diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json index a9d519dec69..8852928771f 100644 --- a/dev/examples/zapier/package.json +++ b/dev/examples/zapier/package.json @@ -15,7 +15,7 @@ "npm": ">=5.6.0" }, "dependencies": { - "zapier-platform-core": "11.0.1" + "zapier-platform-core": "11.3.1" }, "devDependencies": { "mocha": "^5.2.0", diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 29c2b7d5510..fd0ff2e72da 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -185,11 +185,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $ok = 0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ } if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2)) { $ok = 0; @@ -228,17 +223,17 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $i = 0; foreach ($listfieldinsert as $f => $value) { if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); + $_POST[$listfieldvalue[$i]] = price2num(GETPOST($listfieldvalue[$i]), 'MU'); } elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } @@ -276,7 +271,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $i = 0; foreach ($listfieldmodify as $field) { if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); + $_POST[$listfieldvalue[$i]] = price2num(GETPOST($listfieldvalue[$i]), 'MU'); } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } @@ -284,10 +279,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $sql .= ","; } $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index bb629577ab6..c0439445261 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -148,10 +148,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($value == 'formula' && !GETPOST('formula')) { continue; } - if ($value == 'range_account' && empty($_POST['range_account'])) { + if ($value == 'range_account' && !GETPOST('range_account')) { continue; } - if (($value == 'country' || $value == 'country_id') && (!empty($_POST['country_id']))) { + if (($value == 'country' || $value == 'country_id') && GETPOST('country_id')) { continue; } if (!GETPOSTISSET($value) || GETPOST($value) == '') { @@ -195,17 +195,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors'); } - // Clean some parameters - if ($_POST["accountancy_code"] <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_sell"] <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_buy"] <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { if ($tabrowid[$id]) { @@ -243,7 +232,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'formula') { + if (GETPOST($listfieldvalue[$i]) == '' && !$listfieldvalue[$i] == 'formula') { $sql .= "null"; // For vat, we want/accept code = '' } else { $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; @@ -283,8 +272,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'fk_country' && $_POST['country'] > 0) { - $_POST[$listfieldvalue[$i]] = $_POST['country']; + if ($field == 'fk_country' && GETPOST('country') > 0) { + $_POST[$listfieldvalue[$i]] = GETPOST('country'); } elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } @@ -292,10 +281,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $sql .= ","; } $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '' && !$listfieldvalue[$i] == 'range_account') { + if (GETPOST($listfieldvalue[$i]) == '' && !$listfieldvalue[$i] == 'range_account') { $sql .= "null"; // For range_account, we want/accept code = '' } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 7f000290e1c..de6b8374c2a 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -165,45 +165,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { // Check that all fields are filled $ok = 1; - foreach ($listfield as $f => $value) { - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) { - $fieldnamekey = 'Label'; - } - if ($fieldnamekey == 'code') { - $fieldnamekey = 'Code'; - } - if ($fieldnamekey == 'nature') { - $fieldnamekey = 'NatureOfJournal'; - } - } + // Other checks if (GETPOSTISSET("code")) { if (GETPOST("code") == '0') { $ok = 0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); } - /*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base - { - $ok = 0; - $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'
'; - }*/ } if (!GETPOST('label', 'alpha')) { setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); $ok = 0; } - // Clean some parameters - if ($_POST["accountancy_code"] <= 0) { - $_POST["accountancy_code"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_sell"] <= 0) { - $_POST["accountancy_code_sell"] = ''; // If empty, we force to null - } - if ($_POST["accountancy_code_buy"] <= 0) { - $_POST["accountancy_code_buy"] = ''; // If empty, we force to null - } - // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { if ($tabrowid[$id]) { @@ -235,16 +209,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; - } if ($i) { $sql .= ","; } - if ($_POST[$listfieldvalue[$i]] == '') { + if (GETPOST($listfieldvalue[$i]) == '') { $sql .= "null"; // For vat, we want/accept code = '' } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; } $i++; } @@ -254,7 +225,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { $result = $db->query($sql); if ($result) { // Add is ok setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST = array('id'=>$id); // Clean $_POST array, we keep only + $_POST = array('id'=>$id); // Clean $_POST array, we keep only id } else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); @@ -281,24 +252,15 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { } $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { - $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU'); - } elseif ($field == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; - } if ($i) { $sql .= ","; } - $sql .= $field."="; - if ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) { - $sql .= "null"; // For vat, we want/accept code = '' - } else { - $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'"; - } + $sql .= $field." = "; + $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i]))."'"; $i++; } $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); dol_syslog("actionmodify", LOG_DEBUG); //print $sql; @@ -323,7 +285,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete } $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); dol_syslog("delete", LOG_DEBUG); $result = $db->query($sql); @@ -410,7 +372,7 @@ if ($action == 'delete') { if ($id) { // Complete requete recherche valeurs avec critere de tri $sql = $tabsql[$id]; - $sql .= " WHERE a.entity = ".$conf->entity; + $sql .= " WHERE a.entity = ".((int) $conf->entity); // If sort order is "country", we use country_code instead if ($sortfield == 'country') { @@ -510,7 +472,7 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $param = '&id='.$id; + $param = '&id='.((int) $id); if ($search_country_id > 0) { $param .= '&search_country_id='.urlencode($search_country_id); } @@ -635,7 +597,7 @@ if ($id) { $class = 'tddict'; // Show value for field if ($showfield) { - print ''.$valuetoshow.''; + print ''.dol_escape_htmltag($valuetoshow).''; } } } diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 8a66acee0d9..5b645796a32 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -663,7 +663,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } @@ -746,7 +746,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1); + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print ''; } diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index ece843515e2..ea88534b6ed 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -55,8 +55,8 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); - $credit = trim($arrayrecord[12]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); + $credit = floatval(trim($arrayrecord[12]['val'])); if (!empty($debit)) { $amount = $debit; } else { @@ -86,7 +86,7 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); if (!empty($debit)) { $sens = 'D'; } else { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 58eeb2afd2b..a83a311010d 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -331,7 +331,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features + $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -745,7 +745,7 @@ class BookKeeping extends CommonObject $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (null !== $ref) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { @@ -890,7 +890,7 @@ class BookKeeping extends CommonObject } $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); } @@ -1046,7 +1046,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if ($showAlreadyExportMovements == 0) { $sql .= " AND t.date_export IS NULL"; } @@ -1166,7 +1166,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); } @@ -1464,7 +1464,7 @@ class BookKeeping extends CommonObject */ public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0) { - global $langs; + global $conf, $langs; if (empty($delyear) && empty($journal)) { $this->error = 'ErrorOneFieldRequired'; @@ -1485,7 +1485,7 @@ class BookKeeping extends CommonObject if (!empty($journal)) { $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; } - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features // Exclusion of validated entries at the time of deletion $sql .= " AND date_validated IS NULL"; @@ -1524,7 +1524,7 @@ class BookKeeping extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE piece_num = ".(int) $piecenum; $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resql = $this->db->query($sql); @@ -1646,7 +1646,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".((int) $piecenum); - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1684,9 +1684,10 @@ class BookKeeping extends CommonObject global $conf; $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features + + dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); - dol_syslog(get_class($this)."getNextNumMvt", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1727,7 +1728,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".((int) $piecenum); - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1790,7 +1791,7 @@ class BookKeeping extends CommonObject $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; $sql .= " date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); @@ -1846,6 +1847,8 @@ class BookKeeping extends CommonObject */ public function transformTransaction($direction = 0, $piece_num = '') { + global $conf; + $error = 0; $this->db->begin(); @@ -1865,14 +1868,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1880,7 +1883,7 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } } elseif ($direction == 1) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1895,14 +1898,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1957,7 +1960,7 @@ class BookKeeping extends CommonObject $sql .= " AND aa.active = 1"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = ".((int) $pcgver); - $sql .= " AND ab.entity IN (".getEntity('accountancy').")"; + $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $sql .= " ORDER BY account_number ASC"; dol_syslog(get_class($this)."::select_account", LOG_DEBUG); @@ -2021,7 +2024,7 @@ class BookKeeping extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; - $sql .= " AND aa.entity IN (".getEntity('accountancy').")"; + $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account", LOG_DEBUG); $resql = $this->db->query($sql); @@ -2061,7 +2064,7 @@ class BookKeeping extends CommonObject $sql .= " AND asy.rowid = ".((int) $pcgver); $sql .= " AND aa.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; - $sql .= " WHERE aa.entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 7ce226f99d8..70e79e31063 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -500,6 +500,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 37abd56a21d..08657fe7a62 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -199,7 +199,25 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - print ''.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + $cursormonth = $j; + if ($cursormonth > 12) { + $cursormonth -= 12; + } + $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); + + print ''; + if (!empty($tmp['mday'])) { + $param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear; + $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; + $param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year']; + print ''; + } + print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)); + if (!empty($tmp['mday'])) { + print ''; + } + print ''; } print ''.$langs->trans("Total").''; @@ -226,6 +244,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); $resql = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index fb3bf1a6e04..ff7b9295693 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -26,8 +26,8 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -49,9 +49,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -61,9 +66,9 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa if (empty($page) || $page < 0) { $page = 0; } +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$offset = $limit * $page; if (!$sortfield) { $sortfield = "erd.date, erd.rowid"; } @@ -101,9 +106,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; } if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { @@ -204,7 +214,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); @@ -222,9 +237,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/lines.php::list'); +dol_syslog("accountancy/expensereport/lines.php", LOG_DEBUG); $result = $db->query($sql); - if ($result) { $num_lines = $db->num_rows($result); $i = 0; @@ -254,14 +268,23 @@ if ($result) { if ($search_vat) { $param .= "&search_vat=".urlencode($search_vat); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } print '
'."\n"; @@ -276,12 +299,11 @@ if ($result) { print ''; print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneExpenseReport").'
'; - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '
'; + print '
'; $moreforfilter = ''; @@ -296,11 +318,12 @@ if ($result) { print ''; } print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; print ''; print ''; @@ -394,12 +417,11 @@ if ($result) { print ''.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).''; // Accounting account affected - print ''; + print ''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print ' '; print img_edit(); print ''; - print ''; print ""; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 863001c3bc0..d95f4ff67b9 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -30,9 +30,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page @@ -59,9 +59,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -83,6 +88,9 @@ if (!$sortorder) { } } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('accountancyexpensereportlist')); + $formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); @@ -101,7 +109,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { /* - * Action + * Actions */ if (GETPOST('cancel', 'alpha')) { @@ -111,30 +119,47 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -// Purge search criteria -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers - $search_login = ''; - $search_expensereport = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + $search_login = ''; + $search_expensereport = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_country = ''; + $search_tvaintra = ''; + } + + // Mass actions + $objectclass = 'ExpenseReport'; + $objectlabel = 'ExpenseReport'; + $permissiontoread = $user->rights->expensereport->read; + $permissiontodelete = $user->rights->expensereport->delete; + $uploaddir = $conf->expensereport->dir_output; + include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; } -// Mass actions -$objectclass = 'ExpenseReport'; -$objectlabel = 'ExpenseReport'; -$permissiontoread = $user->rights->expensereport->read; -$permissiontodelete = $user->rights->expensereport->delete; -$uploaddir = $conf->expensereport->dir_output; -include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $msg = ''; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; @@ -159,7 +184,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, '', 1); - dol_syslog('accountancy/expensereport/list.php', LOG_DEBUG); + dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG); if ($db->query($sql)) { $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; @@ -201,6 +226,9 @@ $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, er $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " u.rowid as userid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,"; $sql .= " aa.rowid as aarowid"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; @@ -233,9 +261,19 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", $search_vat, 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -251,7 +289,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/list.php'); +dol_syslog("accountancy/expensereport/list.php", LOG_DEBUG); +// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso) +// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=1"); +} + $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); @@ -272,14 +316,23 @@ if ($result) { if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } if ($search_expensereport) { $param .= '&search_expensereport='.urlencode($search_expensereport); @@ -302,7 +355,6 @@ if ($result) { ); $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1); - print ''."\n"; print ''; if ($optioncss != '') { @@ -335,20 +387,21 @@ if ($result) { if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { print ''; } - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; @@ -468,6 +521,9 @@ if ($result) { } else { print $db->error(); } +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation +} // Add code to auto check the box when we select an account print ' + + close(); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 58ef900c31d..20ff5fe27b1 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,7 +1085,8 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); - $this->total_cost += $bom_child->total_cost; + $line->childBom[] = $bom_child; + $this->total_cost += $bom_child->total_cost * $line->qty; } else { $this->error = $bom_child->error; return -2; @@ -1101,6 +1102,54 @@ class BOM extends CommonObject } } } + + /** + * Get Net needs by product + * + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed + * @return void + */ + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } else { + $TNetNeeds[$line->fk_product] += $line->qty*$qty; + } + } + } + } + + /** + * Get Net needs Tree by product or bom + * + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed + * @param int $level level of recursivity + * @return void + */ + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) { + $TNetNeeds[$childBom->id]['bom'] = $childBom; + $TNetNeeds[$childBom->id]['parentid'] = $this->id; + $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; + $TNetNeeds[$childBom->id]['level'] = $level; + $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); + } + } else { + $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; + $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; + } + } + } + } } @@ -1227,6 +1276,11 @@ class BOMLine extends CommonObjectLine public $unit_cost = 0; + /** + * @var Bom array of Bom in line + */ + public $childBom = array(); + /** * Constructor * diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 805ba304c1d..954959d5d7a 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -84,6 +84,11 @@ function bomPrepareHead($object) $head[$h][2] = 'card'; $h++; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_net_needs.php?id=".$object->id; + $head[$h][1] = $langs->trans("BOMNetNeeds"); + $head[$h][2] = 'net_needs'; + $h++; + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; if (!empty($object->note_private)) { diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index b72ed043581..8040310ea53 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -180,6 +180,7 @@ if ($action == 'selectlines') { print ''; // Select of all the sub-BOM lines +// From this pont to the end of the file, we only take care of sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; $sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; $resql = $object->db->query($sql); @@ -191,7 +192,9 @@ if ($resql) { $sub_bom_product->fetch($obj->fk_product); $sub_bom = new BOM($object->db); - $sub_bom->fetch($obj->fk_bom_child); + if (!empty($obj->fk_bom_child)) { + $sub_bom->fetch($obj->fk_bom_child); + } $sub_bom_line = new BOMLine($object->db); $sub_bom_line->fetch($obj->rowid); @@ -233,20 +236,23 @@ if ($resql) { // Efficiency print ''.$sub_bom_line->efficiency.''; - // Cost price if it's defined - if ($sub_bom_product->cost_price > 0) { - print ''.price($sub_bom_product->cost_price * $line->qty).''; - $total_cost+= $sub_bom_product->cost_price * $line->qty; + if (!empty($sub_bom->id)) { + $sub_bom->calculateCosts(); + print ''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''; + $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + } elseif ($sub_bom_product->cost_price > 0) { + print ''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''; + $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''.price($sub_bom_product->pmp * $line->qty).''; - $total_cost.= $sub_bom_product->pmp * $line->qty; + print ''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''; + $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id; $resql_supplier_price = $object->db->query($sql_supplier_price); if ($resql_supplier_price) { $obj = $object->db->fetch_object($resql_supplier_price); - $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty; + $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; print ''.price($line_cost).''; $total_cost+= $line_cost; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 83b5b69283f..e5781d98561 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -66,7 +66,7 @@ function printDropdownBookmarksList() // Url to list bookmark - $listbtn = ''; + $listbtn = ''; $listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').''; // Url to go on create new bookmark page diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e85d9864407..a3d2dc3e57f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -185,7 +185,8 @@ class Categorie extends CommonObject 'contact' => 'socpeople', 'account' => 'bank_account', // old for bank account 'project' => 'projet', - 'warehouse'=> 'entrepot' + 'warehouse'=> 'entrepot', + 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord' ); /** diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 2b3ffc95c41..518889b85b3 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -178,7 +178,9 @@ print ''; // Parent category print ''.$langs->trans("In").''; +print img_picto('', 'category', 'class="pictofixedwidth"'); print $form->select_all_categories($type, $object->fk_parent, 'parent', 64, $object->id); +print ajax_combobox('parent'); print ''; $parameters = array(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 627c2f0ce51..4a00894d26b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -76,11 +76,14 @@ if ($complete == 'na' || $complete == -2) { } if ($fulldayevent) { - $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + //print $db->idate($datep); exit; } else { - $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); + $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } // Security check @@ -252,8 +255,15 @@ if (empty($reshook) && $action == 'add') { $percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters - $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } // Check parameters if (!$datef && $percentage == 100) { @@ -513,8 +523,16 @@ if (empty($reshook) && $action == 'update') { $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + // Clean parameters + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1005,11 +1023,11 @@ if ($action == 'create') { $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep)); if (GETPOST('datep', 'int', 1)) { - $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); + $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser'); } $datef = ($datef ? $datef : $object->datef); if (GETPOST('datef', 'int', 1)) { - $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0); + $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser'); } if (empty($datef) && !empty($datep)) { if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) { @@ -1024,16 +1042,16 @@ if ($action == 'create') { print ''.$langs->trans("DateActionEnd").''; print ''; if (GETPOST("afaire") == 1) { - print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo" + print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo" } else { - print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart'); + print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); } print '     -     '; //print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } else { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } print ''; @@ -1518,20 +1536,21 @@ if ($id > 0) { // Date start - end print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); if (GETPOST("afaire") == 1) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print ''; @@ -1972,7 +1991,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -1985,7 +2005,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 103fea28731..a5b4f1d8ce9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1955,14 +1955,14 @@ class ActionComm extends CommonObject $event = array(); $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type'] = $type; + $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered if (is_numeric($this->db->jdate($obj->datep2))) { - $dateend = $this->db->jdate($obj->datep2) - - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); } else { - // use start date as fall-back to avoid import erros on empty end date + // use start date as fall-back to avoid pb with empty end date on ICS readers $dateend = $datestart; } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index c69d396cf26..3de00e9cb6f 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -201,7 +201,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -214,7 +215,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d3538c6a2c9..e8060bc314d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -545,7 +545,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode); //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; + $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); } @@ -808,11 +809,21 @@ if ($resql) { $event->id = $obj->id; $event->ref = $event->id; - $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin - $event->datef = $db->jdate($obj->datep2); + $event->fulldayevent = $obj->fulldayevent; + + // event->datep and event->datef must be GMT date. + if ($event->fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz + $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); + } else { + // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) + $event->datep = $db->jdate($obj->datep, 'tzserver'); + $event->datef = $db->jdate($obj->datep2, 'tzserver'); + } //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); - //var_dump($obj->datep); - //var_dump($event->datep); + //var_dump($obj->id.' '.$obj->datep.' '.dol_print_date($obj->datep, 'dayhour', 'gmt')); + //var_dump($obj->id.' '.$event->datep.' '.dol_print_date($event->datep, 'dayhour', 'gmt')); $event->type_code = $obj->type_code; $event->type_label = $obj->type_label; @@ -829,7 +840,6 @@ if ($resql) { $event->fetch_userassigned(); // This load $event->userassigned $event->priority = $obj->priority; - $event->fulldayevent = $obj->fulldayevent; $event->location = $obj->location; $event->transparency = $obj->transparency; $event->fk_element = $obj->fk_element; @@ -865,25 +875,43 @@ if ($resql) { $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); + + $daycursorend = $event->date_end_in_calendar; + $anneeend = dol_print_date($daycursorend, '%Y', 'tzuserrel'); + $moisend = dol_print_date($daycursorend, '%m', 'tzuserrel'); + $jourend = dol_print_date($daycursorend, '%d', 'tzuserrel'); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich //var_dump($annee.'-'.$mois.'-'.$jour); + //print 'annee='.$annee.' mois='.$mois.' jour='.$jour.'
'; // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz + /* + print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'
'; + print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'
'; + */ do { //if ($event->id==408) - //print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'tzuserrel').' - '.dol_print_date($event->datep, 'dayhour', 'tzuserrel').' '.dol_print_date($event->datef, 'dayhour', 'tzuserrel').'
'; $eventarray[$daykey][] = $event; $j++; $daykey += 60 * 60 * 24; - if ($daykey > $event->date_end_in_calendar) { + //if ($daykey > $event->date_end_in_calendar) { + if ($daykey > $daykeyend) { $loop = false; } } while ($loop); - + //var_dump($eventarray); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } @@ -1805,12 +1833,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cssclass .= " unmovable"; } elseif ($event->type_code == 'ICALEVENT') { $cssclass .= " unmovable"; - } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { - $tmpyearend = date('Y', $event->date_end_in_calendar); - $tmpmonthend = date('m', $event->date_end_in_calendar); - $tmpdayend = date('d', $event->date_end_in_calendar); + } elseif ($event->date_start_in_calendar && $event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { + // If the event is on several days + $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel'); + $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel'); + $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel'); + //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend); if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) { - $cssclass .= " unmovable"; + $cssclass .= " unmovable unmovable-mustusefirstdaytodrag"; + } else { + $cssclass .= ' movable cursormove'; } } else { if ($user->rights->agenda->allactions->create || diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index de961b5517e..e2b412e15db 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -693,7 +693,7 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; //$param='month='.$monthshown.'&year='.$year; -$hourminsec = '100000'; +$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; @@ -953,7 +953,12 @@ while ($i < min($num, $limit)) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } $late = 0; if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) { $late = 1; @@ -967,7 +972,12 @@ while ($i < min($num, $limit)) { // End date if (!empty($arrayfields['a.datep2']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } print ''; } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 90d3ed128f7..eabcb1a55bf 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -214,7 +214,7 @@ if (empty($reshook)) { // assujetissement a la TVA if ($action == 'setassujtva' && $user->rights->societe->creer) { $object->fetch($id); - $object->tva_assuj = $_POST['assujtva_value']; + $object->tva_assuj = GETPOST('assujtva_value'); $result = $object->update($object->id); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 79faf4b2cd2..f82df06313b 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -745,7 +745,7 @@ if ($action == 'create') { print ''; print ''; print ''; print '
'.$langs->trans("MailTopic").'
'.$langs->trans("BackgroundColorByDefault").''; - print $htmlother->selectColor($_POST['bgcolor'], 'bgcolor', '', 0); + print $htmlother->selectColor(GETPOST('bgcolor'), 'bgcolor', '', 0); print '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 746075ab51e..61ecb966359 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -302,7 +302,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setdate' && $usercancreate) { - $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datep = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datep)) { $error++; @@ -316,7 +316,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setecheance' && $usercancreate) { - $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + $result = $object->set_echeance($user, dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'))); if ($result >= 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; @@ -339,7 +339,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth', 'int'), GETPOST('date_livraisonday', 'int'), GETPOST('date_livraisonyear', 'int'))); if ($result < 0) { dol_print_error($db, $object->error); } @@ -1955,7 +1955,7 @@ if ($action == 'create') { // We verify whether the object is provisionally numbering $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') { + if ($ref == 'PROV' || $ref == '') { $numref = $object->getNextNumRef($soc); if (empty($numref)) { $error++; @@ -2543,7 +2543,7 @@ if ($action == 'create') { if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) || ($object->statut == Propal::STATUS_DRAFT && !empty($conf->global->PROPAL_ENABLE_NEGATIVE) && count($object->lines) > 0)) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print ''.$langs->trans('Validate').''; } else { print ''.$langs->trans('Validate').''; } @@ -2555,7 +2555,7 @@ if ($action == 'create') { }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } // ReOpen @@ -2578,7 +2578,7 @@ if ($action == 'create') { // Create a sale order if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } } @@ -2586,7 +2586,7 @@ if ($action == 'create') { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) { if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { if ($usercancreatepurchaseorder) { - print ''.$langs->trans("AddPurchaseOrder").''; + print ''.$langs->trans("AddPurchaseOrder").''; } } } @@ -2595,7 +2595,7 @@ if ($action == 'create') { if (!empty($conf->service->enabled) && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); - print ''.$langs->trans("AddIntervention").''; + print ''.$langs->trans("AddIntervention").''; } } @@ -2604,14 +2604,14 @@ if ($action == 'create') { $langs->load("contracts"); if ($usercancreatecontract) { - print ''.$langs->trans('AddContract').''; + print ''.$langs->trans('AddContract').''; } } // Create an invoice and classify billed if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index fedf6a6233d..989dcfe7098 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -107,12 +107,6 @@ if ($action == 'addcontact' && $user->rights->propale->creer) { dol_print_error($db); } } -/* -elseif ($action == 'setaddress' && $user->rights->propale->creer) -{ - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 4404f9758a6..d44093dbab5 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -160,7 +160,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) { $amount_ht = price2num(GETPOST('amount_ht', 'alpha')); $desc = GETPOST('desc', 'alpha'); $tva_tx = GETPOST('tva_tx', 'alpha'); - $discount_type = !empty($_POST['discount_type']) ?GETPOST('discount_type', 'alpha') : 0; + $discount_type = GETPOSTISSET('discount_type') ? GETPOST('discount_type', 'alpha') : 0; if ($amount_ht > 0) { $error = 0; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 72851c3943a..1470ee210e8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -533,7 +533,6 @@ if (empty($reshook)) { } } } elseif ($action == 'setdate' && $usercancreate) { - // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date = dol_mktime(0, 0, 0, GETPOST('order_month', 'int'), GETPOST('order_day', 'int'), GETPOST('order_year', 'int')); $result = $object->set_date($user, $date); @@ -541,7 +540,6 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); @@ -1902,8 +1900,12 @@ if ($action == 'create' && $usercancreate) { if ($action == 'validate') { // We check that object has a temporary ref $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') { + if ($ref == 'PROV' || $ref == '') { $numref = $object->getNextNumRef($soc); + if (empty($numref)) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } else { $numref = $object->ref; } @@ -1954,8 +1956,9 @@ if ($action == 'create' && $usercancreate) { if ($nbMandated > 0 ) $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + if (!$error) { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + } } // Confirm back to draft status diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index a4d857a47fd..b89623fc3a0 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -91,13 +91,6 @@ if ($action == 'addcontact' && $user->rights->commande->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -/* -elseif ($action == 'setaddress' && $user->rights->commande->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index bdeeb072e97..0332a925f9d 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -47,10 +47,10 @@ $langs->load('compta'); //init var $invoice_type = GETPOST('invoice_type', 'int'); -$amountPayment = $_POST['amountPayment']; -$amounts = $_POST['amounts']; // from text inputs : invoice amount payment (check required) -$remains = $_POST['remains']; // from dolibarr's object (no need to check) -$currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invoice id) +$amountPayment = GETPOST('amountPayment'); +$amounts = GETPOST('amounts'); // from text inputs : invoice amount payment (check required) +$remains = GETPOST('remains'); // from dolibarr's object (no need to check) +$currentInvId = GETPOST('imgClicked'); // from DOM elements : imgId (equals invoice id) // Getting the posted keys=>values, sanitize the ones who are from text inputs $amountPayment = $amountPayment != '' ? (is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '') : ''; // keep void if not a valid entry diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 78940872106..f8cc88e1be4 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -124,6 +124,7 @@ if (empty($reshook)) { $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); $object->domiciliation = trim(GETPOST("domiciliation", "nohtml")); + $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); @@ -224,6 +225,7 @@ if (empty($reshook)) { $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); $object->domiciliation = trim(GETPOST("domiciliation", "nohtml")); + $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); @@ -283,7 +285,7 @@ if (empty($reshook)) { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu + $_GET["id"] = GETPOST("id", 'int'); // Force chargement page en mode visu } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -377,7 +379,7 @@ if ($action == 'create') { // Type print ''.$langs->trans("AccountType").''; print ''; - $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'alpha') : Account::TYPE_CURRENT, 'type'); + $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type'); print ''; // Currency @@ -490,7 +492,7 @@ if ($action == 'create') { print ''; print '
'; - $type = GETPOST('type'); + $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''; @@ -537,6 +539,13 @@ if ($action == 'create') { print ''; print ''; + if ($conf->paymentbybanktransfer->enabled) { + print ''; + print ''; + } + print '\n"; + print '\n"; } dol_syslog('Admin.lib::run_sql Request '.($i + 1), LOG_DEBUG); $sqlmodified = 0; @@ -454,18 +455,18 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle //if (!empty($conf->use_javascript_ajax)) { // use_javascript_ajax is not defined print ''; - print ' - '.$langs->trans("ShowHideDetails").''; + print ' - '.$langs->trans("ShowHideDetails").''; //} print ''."\n"; @@ -1627,6 +1628,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu if (empty($strictw3c)) { print "\n".''; print ''; + print ''; } print ''; @@ -1733,7 +1735,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu // Submit if (empty($strictw3c)) { print '"; } @@ -1748,7 +1750,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu print ''; if (!empty($strictw3c) && $strictw3c == 1) { - print '
'; + print '
'; print "\n"; } } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d4028e2196b..237adc9447a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -357,18 +357,18 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu * Convert a string date into a GM Timestamps date * Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string. * - * @param string $string Date in a string - * YYYYMMDD - * YYYYMMDDHHMMSS - * YYYYMMDDTHHMMSSZ - * YYYY-MM-DDTHH:MM:SSZ (RFC3339) - * DD/MM/YY or DD/MM/YYYY (deprecated) - * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) - * @param int $gm 1 =Input date is GM date, - * 0 =Input date is local date using PHP server timezone - * @return int Date as a timestamp - * 19700101020000 -> 7200 with gm=1 - * 19700101000000 -> 0 with gm=1 + * @param string $string Date in a string + * YYYYMMDD + * YYYYMMDDHHMMSS + * YYYYMMDDTHHMMSSZ + * YYYY-MM-DDTHH:MM:SSZ (RFC3339) + * DD/MM/YY or DD/MM/YYYY (deprecated) + * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) + * @param int|string $gm 'gmt' or 1 =Input date is GM date, + * 'tzserver' or 0 =Input date is date using PHP server timezone + * @return int Date as a timestamp + * 19700101020000 -> 7200 with gm=1 + * 19700101000000 -> 0 with gm=1 * * @see dol_print_date(), dol_mktime(), dol_getdate() */ @@ -408,7 +408,14 @@ function dol_stringtotime($string, $gm = 1) $string = preg_replace('/([^0-9])/i', '', $string); $tmp = $string.'000000'; - $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), ($gm ? 1 : 0)); + // Clean $gm + if ($gm === 1) { + $gm = 'gmt'; + } elseif (empty($gm) || $gm === 'tzserver') { + $gm = 'tzserver'; + } + + $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); return $date; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c70ea041e0a..efde963d077 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -987,7 +987,7 @@ function dol_unescapefile($filename) */ function dolCheckVirus($src_file) { - global $conf; + global $conf, $db; if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { if (!class_exists('AntiVir')) { @@ -2348,15 +2348,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file))); $original_file = $dolibarr_main_data_root.'/'.$original_file; } elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { - // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log + // Wrapping for doctemplates $accessallowed = $user->admin; $original_file = $dolibarr_main_data_root.'/doctemplates/'.$original_file; } elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { - // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip + // Wrapping for doctemplates of websites $accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file))); $original_file = $dolibarr_main_data_root.'/doctemplates/websites/'.$original_file; } elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { - // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip + // Wrapping for *.zip package files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip // Dir for custom dirs $tmp = explode(',', $dolibarr_main_document_root_alt); $dirins = $tmp[0]; @@ -2369,11 +2369,21 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->mycompany->dir_output.'/'.$original_file; } elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { // Wrapping for users photos - $accessallowed = 1; + $accessallowed = 0; + if (preg_match('/^\d+\/photos\//', $original_file)) { + $accessallowed = 1; + } $original_file = $conf->user->dir_output.'/'.$original_file; + } elseif (($modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) { + // Wrapping for users logos + $accessallowed = 1; + $original_file = $conf->mycompany->dir_output.'/logos/'.$original_file; } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { // Wrapping for members photos - $accessallowed = 1; + $accessallowed = 0; + if (preg_match('/^\d+\/photos\//', $original_file)) { + $accessallowed = 1; + } $original_file = $conf->adherent->dir_output.'/'.$original_file; } elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { // Wrapping pour les apercu factures @@ -2424,10 +2434,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; } elseif (($modulepart == 'holiday') && !empty($conf->holiday->dir_output)) { - if ($fuser->rights->holiday->{$read} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->holiday->{$read} || !empty($fuser->rights->holiday->readall) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; // If we known $id of holiday, call checkUserAccessToObject to check permission on properties and hierarchy of leave request - if ($refname && !preg_match('/^specimen/i', $original_file)) { + if ($refname && empty($fuser->rights->holiday->readall) && !preg_match('/^specimen/i', $original_file)) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $tmpholiday = new Holiday($db); $tmpholiday->fetch('', $refname); @@ -2436,10 +2446,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->holiday->dir_output.'/'.$original_file; } elseif (($modulepart == 'expensereport') && !empty($conf->expensereport->dir_output)) { - if ($fuser->rights->expensereport->{$lire} || preg_match('/^specimen/i', $original_file)) { + if ($fuser->rights->expensereport->{$lire} || !empty($fuser->rights->expensereport->readall) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; // If we known $id of expensereport, call checkUserAccessToObject to check permission on properties and hierarchy of expense report - if ($refname && !preg_match('/^specimen/i', $original_file)) { + if ($refname && empty($fuser->rights->expensereport->readall) && !preg_match('/^specimen/i', $original_file)) { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $tmpexpensereport = new ExpenseReport($db); $tmpexpensereport->fetch('', $refname); @@ -2448,7 +2458,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->expensereport->dir_output.'/'.$original_file; } elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { - // Wrapping pour les apercu supplier invoice + // Wrapping pour les apercu expense report if ($fuser->rights->expensereport->{$lire}) { $accessallowed = 1; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c1a4dbedc39..3b0e90c9013 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -665,16 +665,16 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } // Sanitizing for special parameters. - // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. + // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') { - $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. - $out = str_replace(array(':', ';', '@'), '', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. + $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. + $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retreive it after other replacements. do { $oldstringtoclean = $out; $out = str_ireplace(array('javascript', 'vbscript', '&colon', '&#'), '', $out); + $out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc' + $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL } while ($oldstringtoclean != $out); - - $out = preg_replace(array('/^[a-z]*\/\/+/i'), '', $out); // We remove schema*// to remove external URL } // Code for search criteria persistence. @@ -713,11 +713,11 @@ function GETPOSTINT($paramname, $method = 0) /** * Return a value after checking on a rule. A sanitization may also have been done. * - * @param string $out Value to check/clear. - * @param string $check Type of check/sanitizing - * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) - * @param mixed $options Options to pass to filter_var when $check is set to 'custom' - * @return string|array Value sanitized (string or array). It may be '' if format check fails. + * @param string|array $out Value to check/clear. + * @param string $check Type of check/sanitizing + * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) + * @param mixed $options Options to pass to filter_var when $check is set to 'custom' + * @return string|array Value sanitized (string or array). It may be '' if format check fails. */ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null) { @@ -870,31 +870,32 @@ if (!function_exists('dol_getprefix')) { * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir * or two instances in same virtual servers. + * This function must not use dol_hash (that is used for password hash) and need to have all context $conf loaded. * * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @return string A calculated prefix */ function dol_getprefix($mode = '') { - // If prefix is for email (we need to have $conf alreayd loaded for this case) + // If prefix is for email (we need to have $conf already loaded for this case) if ($mode == 'email') { global $conf; - if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) + if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; - } elseif (isset($_SERVER["SERVER_NAME"])) { + } elseif (isset($_SERVER["SERVER_NAME"])) { // If MAIL_PREFIX_FOR_EMAIL_ID is set to 'SERVER_NAME' return $_SERVER["SERVER_NAME"]; } } - // The recommended value (may be not defined for old versions) + // The recommended value if MAIL_PREFIX_FOR_EMAIL_ID is not defined (may be not defined for old versions) if (!empty($conf->file->instance_unique_id)) { - return $conf->file->instance_unique_id; + return sha1('dolibarr'.$conf->file->instance_unique_id); } - // For backward compatibility - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + // For backward compatibility when instance_unique_id is not set + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } // If prefix is for session (no need to have $conf loaded) @@ -903,15 +904,15 @@ if (!function_exists('dol_getprefix')) { // The recommended value (may be not defined for old versions) if (!empty($tmp_instance_unique_id)) { - return $tmp_instance_unique_id; + return sha1('dolibarr'.$tmp_instance_unique_id); } - // For backward compatibility + // For backward compatibility when instance_unique_id is not set if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + return sha1($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + } else { + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } - - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); } } @@ -1104,6 +1105,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = str_replace('..', '', $tmp); return $tmp; } @@ -1127,6 +1129,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1) $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); + $tmp = str_replace('..', '', $tmp); return $tmp; } @@ -2020,7 +2023,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if (empty($phototoshow)) { // Show No photo link (picto of object) - $morehtmlleft .= '
'; if ($object->element == 'action') { $width = 80; $cssclass = 'photorefcenter'; @@ -2042,8 +2044,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $morehtmlleft .= '
'; $morehtmlleft .= $nophoto; $morehtmlleft .= '
'; - - $morehtmlleft .= '
'; } } } @@ -2573,11 +2573,11 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto', { global $conf; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; - //print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'
'; if ($gm === 'auto') { $gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); } + //print 'gm:'.$gm.' gm === auto:'.($gm === 'auto').'
';exit; // Clean parameters if ($hour == -1 || empty($hour)) { @@ -3733,7 +3733,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', - 'label', 'language', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', + 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'puce', @@ -3778,7 +3778,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'entity'=>'globe', 'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', - 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'loan'=>'money-bill-alt', + 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', @@ -6582,16 +6582,18 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes } elseif (in_array($attrs->item($ii)->name, array('style'))) { $valuetoclean = $attrs->item($ii)->value; - do { - $oldvaluetoclean = $valuetoclean; - $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments - $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); - if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. - $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); - } - } while ($oldvaluetoclean != $valuetoclean); + if (isset($valuetoclean)) { + do { + $oldvaluetoclean = $valuetoclean; + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments + $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); + if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. + $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); + } + } while ($oldvaluetoclean != $valuetoclean); + } $attrs->item($ii)->value = $valuetoclean; } @@ -8799,7 +8801,7 @@ function printCommonFooter($zone = 'private') // A div to store page_y POST parameter so we can read it using javascript print "\n\n"; - print ''."\n"; + print ''."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks @@ -10504,6 +10506,7 @@ function newToken() /** * Return the value of token currently saved into session with name 'token'. + * For ajax call, you must use this token as a parameter of the call into the js calling script (the called ajax php page must also set constant NOTOKENRENEWAL). * * @return string */ diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8d992250cbb..64cc4388718 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -225,7 +225,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = } // Common check on ip (local and external) - $arrayofmetadataserver = array('100.100.100.200' => 'Alibaba', '192.0.0.192'=> 'Oracle', '192.80.8.124'=>'Packet'); + // See list on https://tagmerge.com/gist/a7b9d57ff8ec11d63642f8778609a0b8 + // Not evasive url that ar enot IP are excluded by test on IP v4/v6 validity. + $arrayofmetadataserver = array( + '100.100.100.200' => 'Alibaba', + '192.0.0.192' => 'Oracle', + '192.80.8.124' => 'Packet', + '100.88.222.5' => 'Tencent cloud', + ); foreach ($arrayofmetadataserver as $ipofmetadataserver => $nameofmetadataserver) { if ($iptocheck == $ipofmetadataserver) { $info['http_code'] = 400; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a0c6bcfd054..ea8c6c2ce23 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1393,7 +1393,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $note = $prodser->multilangs[$outputlangs->defaultlang]["other"]; } } - } elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + } elseif (($object->element == 'facture' || $object->element == 'facturefourn') && preg_match('/^\(DEPOSIT\).+/', $desc)) { // We must not replace '(DEPOSIT)' when it is alone, it will be translated and detailed later $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index a37a77712c3..e156c83b147 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -187,7 +187,8 @@ if (!function_exists('dol_loginfunction')) { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } - // Set cookie for timeout management + // Set cookie for timeout management. We set it as a cookie so we will be able to use it to set timeout on next page before the session start + // and the conf file is loaded. $prefix = dol_getprefix(''); $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) { diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 066bf2165be..c6b1bdefe6c 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -114,6 +114,11 @@ function stock_admin_prepare_head() $head[$h][2] = 'stockMouvementAttributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php'; + $head[$h][1] = $langs->trans("InventoryExtraFields"); + $head[$h][2] = 'inventoryAttributes'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove'); return $head; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 3599c17887f..2e70bfba3b9 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -476,7 +476,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too $sql .= $db->order($sortfield_new, $sortorder); - dol_syslog("company.lib::show_actions_done", LOG_DEBUG); + dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; @@ -491,7 +491,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $result = $contactaction->fetchResources(); if ($result < 0) { dol_print_error($db); - setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors'); + setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors'); } //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index ca907ae6f1c..138be225166 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -31,6 +31,8 @@ */ function dolStripPhpCode($str, $replacewith = '') { + $str = str_replace('id." / ".$website->ref.")"; diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index fb11846a4fb..f61bd298c62 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -601,3 +601,64 @@ function showWebsiteTemplates(Website $website) print ''; print '
'.$langs->trans($bickey).'
'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").' '; + print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info'); + print '
'.$langs->trans("BankAccountDomiciliation").''; print ''; @@ -257,9 +264,12 @@ class DolEditor $out .= ''."\n"; - } + if (!empty($conf->use_javascript_ajax)) { + $out .= ''."\n"; + $out .= ''."\n"; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 811ad017c4d..1bdd1161770 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -141,7 +141,7 @@ class Form } } } else { - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; } if ($fieldrequired) { @@ -158,10 +158,10 @@ class Form if (!empty($notabletag)) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { @@ -173,10 +173,10 @@ class Form if (!empty($notabletag) && $notabletag == 3) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; } } @@ -1106,13 +1106,13 @@ class Form } print '
'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'
'.$langs->trans("Request").' '.($i + 1)." sql='".dol_htmlentities($newsql, ENT_NOQUOTES)."'
'; - print ''; + print ''; print "
'; } + + +/** + * checkPHPCode + * + * @param string $phpfullcodestringold PHP old string + * @param string $phpfullcodestring PHP new string + * @return int Error or not + */ +function checkPHPCode($phpfullcodestringold, $phpfullcodestring) +{ + global $conf, $langs, $user; + + $error = 0; + + if (empty($phpfullcodestringold) && empty($phpfullcodestring)) { + return 0; + } + + // First check forbidden commands + $forbiddenphpcommands = array(); + if (empty($conf->global->WEBSITE_PHP_ALLOW_EXEC)) { // If option is not on, we disallow functions to execute commands + $forbiddenphpcommands = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI"); + } + if (empty($conf->global->WEBSITE_PHP_ALLOW_WRITE)) { // If option is not on, we disallow functions to write files + $forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "unlink", "mkdir", "rmdir", "symlink", "touch", "umask")); + } + foreach ($forbiddenphpcommands as $forbiddenphpcommand) { + if (preg_match('/'.$forbiddenphpcommand.'\s*\(/ms', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpcommand), null, 'errors'); + break; + } + } + // This char can be used to execute RCE for example using with echo `ls` + $forbiddenphpchars = array(); + if (empty($conf->global->WEBSITE_PHP_ALLOW_DANGEROUS_CHARS)) { // If option is not on, we disallow functions to execute commands + $forbiddenphpchars = array("`"); + } + foreach ($forbiddenphpchars as $forbiddenphpchar) { + if (preg_match('/'.$forbiddenphpchar.'/ms', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar), null, 'errors'); + break; + } + } + // Check dynamic functions $xxx( + if (preg_match('/\$[a-z0-9_]+\(/ims', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors'); + } + + if (!$error && empty($user->rights->website->writephp)) { + if ($phpfullcodestringold != $phpfullcodestring) { + $error++; + setEventMessages($langs->trans("NotAllowedToAddDynamicContent"), null, 'errors'); + } + } + + return $error; +} diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index fcd1660985b..97ada3e3d4f 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) $created = $event["created"]; $modified = $event["modified"]; $assignedUsers = $event["assignedUsers"]; + //print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt'); // Format $summary = format_cal($format, $summary); @@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // Date must be GMT dates // Current date - fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n"); // Start date $prefix = ""; - $startdatef = dol_print_date($startdate, "dayhourxcard", true); + $startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt'); if ($fulldayevent) { // Local time $prefix = ";VALUE=DATE"; - $startdatef = dol_print_date($startdate, "dayxcard", false); + $startdatef = dol_print_date($startdate, "dayxcard", 'gmt'); } fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); @@ -208,6 +209,9 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { + // We add 1 day needed for full day event (DTEND must be next day after event). + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." $enddate = dol_time_plus_duree($startdate, 1, "d"); } } else { @@ -217,14 +221,14 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } $prefix = ""; - $enddatef = dol_print_date($enddate, "dayhourxcard", true); + $enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt'); if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", false); - - // Local time - //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); + // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); @@ -256,11 +260,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } if ($created) { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n"); } if ($modified) { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n"); } fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); @@ -270,7 +274,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); - fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n"); fwrite($calfileh, "END:VJOURNAL\n"); } diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php index 0fce5d50587..9e4bbe72c19 100644 --- a/htdocs/core/login/functions_googleoauth.php +++ b/htdocs/core/login/functions_googleoauth.php @@ -50,7 +50,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto // Get identity from user and redirect browser to Google OAuth Server if (GETPOSTISSET('username')) { /*$openid = new SimpleOpenID(); - $openid->SetIdentity($_POST['username']); + $openid->SetIdentity(GETPOST('username')); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); $openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]); $openid->SetRequiredFields(array('email','fullname')); diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index a0197f18cd3..c101001af4c 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -109,7 +109,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode //$texte.= ''.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):'; $texte .= ''.$langs->trans("Mask").':'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 463cbc46a24..761aae99142 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -152,7 +152,7 @@ class doc_generic_bom_odt extends ModelePDFBom $texte .= $conf->global->BOM_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index b98d403d8f7..c59d1c40ee9 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2dd33bab141..a916bcc534f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index b8bfcdc16ac..9c0088bd398 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index b9ceb3e346b..63a68f7b802 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -366,7 +366,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -374,10 +374,14 @@ class pdf_crabe extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -386,7 +390,7 @@ class pdf_crabe extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -814,6 +818,7 @@ class pdf_crabe extends ModelePDFFactures $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } + dol_syslog("bottomlasttab=".$bottomlasttab." this->page_hauteur=".$this->page_hauteur." heightforinfotot=".$heightforinfotot." heightforfreetext=".$heightforfreetext." heightforfooter=".$heightforfooter); // Display info area $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); @@ -1176,9 +1181,9 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1666545891..7f3b543ebba 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -367,7 +367,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -375,10 +375,14 @@ class pdf_sponge extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -387,7 +391,7 @@ class pdf_sponge extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -1255,9 +1259,9 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 9eeb76cc3cf..781c22ce7e3 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = "'".$this->db->escape($tmp[1])."'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0171eb83ea9..1c38f52cbfc 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -776,7 +776,30 @@ class ImportXlsx extends ModeleImports } elseif (preg_match('/^const-/', $val)) { $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key); - $listvalues[] = "'" . $this->db->escape($tmp[1]) . "'"; + $listvalues[] = "'".$this->db->escape($tmp[1])."'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 8550440d5d1..23aaf6bcd59 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -72,7 +72,7 @@ class mailing_thirdparties extends MailingTargets $addDescription = ""; // Select the third parties from category - if (empty($_POST['filter'])) { + if (!GETPOST('filter')) { $sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, null as label"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 4f1c20a464e..91d2248fb48 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -155,7 +155,7 @@ class doc_generic_member_odt extends ModelePDFMember $texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 15f3260c4d2..0fc13cbe134 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -33,6 +33,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php'; */ class pdf_standard extends CommonStickerGenerator { + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Translations + $langs->loadLangs(array("main", "admin")); + + $this->db = $db; + $this->name = "standard"; + $this->description = $langs->trans('TemplateforBusinessCards'); + //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + + $this->type = 'pdf-various-sizes'; + } /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..0ae6b00b1c3 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -106,7 +106,10 @@ class modTicket extends DolibarrModules $this->const = array( 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), - 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0) + 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0), + 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), + 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0) ); @@ -320,6 +323,11 @@ class modTicket extends DolibarrModules { global $conf, $langs; + $result = $this->_load_tables('/install/mysql/tables/', 'ticket'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index c4abadcd870..7ea6b5a890c 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -164,6 +164,11 @@ class modWebsite extends DolibarrModules { global $conf, $langs; + $result = $this->_load_tables('/install/mysql/tables/', 'website'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Remove permissions and default values $this->remove($options); diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 07f5d5d1890..1df69d7ae53 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_mo_odt extends ModelePDFMo $texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 7fff122ec57..c1f6769579a 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -157,7 +157,7 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 40b1f324cdd..ff724ab209d 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -119,7 +119,7 @@ class mod_codeproduct_elephant extends ModeleProductCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index bad6a369ba6..d653ed760a6 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -450,7 +450,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 1fd0f9c23ee..7849e46edbe 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -417,7 +417,7 @@ class doc_generic_task_odt extends ModelePDFTask $texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e636645f6c8..e2e3ffd2a21 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -161,7 +161,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 7fde8e26c82..f8fd829591d 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -153,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception $texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index aaa9c03c6e7..3a62eb22937 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -143,7 +143,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte .= ''; $texte .= ''; $texte .= '  '; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6079120a305..0142457cd40 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -135,7 +135,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index ff5d737872a..4d1d01db682 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -103,7 +103,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 217e027d152..dddd01a602d 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -126,7 +126,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index c3e26e591c7..1fb120d4d29 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -156,7 +156,7 @@ class doc_generic_stock_odt extends ModelePDFStock $texte .= $conf->global->STOCK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 436622d6451..68caf286682 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $texte .= $conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 04f6ed49012..c79ee188213 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 86b9d44ad9b..d69da78aacc 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -151,7 +151,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $texte .= $conf->global->TICKET_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 656eb88ecaa..353d35fc182 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $conf->global->USER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index e1c83023df9..7ba82f5825e 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index e5c652d7d51..65a3275dab7 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -413,7 +413,6 @@ if ($action == 'confirm_crop') { $fullpath = $dir."/".$original_file; - //var_dump($fullpath.' '.$_POST['w'].'x'.$_POST['h'].'-'.$_POST['x'].'x'.$_POST['y']);exit; $result = dol_imageResizeOrCrop($fullpath, 1, GETPOST('w', 'int'), GETPOST('h', 'int'), GETPOST('x', 'int'), GETPOST('y', 'int')); if ($result == $fullpath) { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b5656c89339..8afa9a16ff0 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -125,14 +125,19 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $lastseparatorkeyfound = $tmpkeyextra; } else { - print 'attributes[$object->table_element]['label'])) { print ' trextrafields_collapse_last'; } - print '">'; + print '"'; + if (empty($extrafields->expand_display[$collapse_group])) { + print ' style="display: none;"'; + } + print '>'; $extrafields_collapse_num_old = $extrafields_collapse_num; print ''; print ''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c07e01570c2..ccec4352e89 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) $_SERVER['CONTENT_LENGTH']; +$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']); if ($size > 10000) { http_response_code(413); $langs->loadLangs(array("errors", "install")); @@ -136,7 +136,7 @@ $(document).ready(function () { - + diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5014b47e9d3..9c5ddf44229 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -360,7 +360,7 @@ if ($nolinesbefore) { } if (is_object($objectline)) { $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); - ; + if (!empty($temps)) { print '
'; print $temps; diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index e81a4a30af5..5128509c88c 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -78,7 +78,7 @@ if ($action == 'add_payment') { foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num($_POST[$key]); + $amounts[$other_chid] = price2num(GETPOST($key)); } } @@ -110,7 +110,7 @@ if ($action == 'add_payment') { } if (!$error) { - $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', $_POST['accountid'], '', ''); + $result = $payment->addPaymentToBank($user, 'payment_donation', '(DonationPayment)', GETPOST('accountid', 'int'), '', ''); if (!$result > 0) { $errmsg = $payment->error; setEventMessages($errmsg, null, 'errors'); diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index afdee363f24..cda9274e6d6 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -111,7 +111,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $massaction = 'presend_attendees'; } - $receiver = $_POST['receiver']; + $receiver = GETPOST('receiver', 'alphawithlgt'); if (!is_array($receiver)) { if (empty($receiver) || $receiver == '-1') { $receiver = array(); @@ -143,7 +143,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $sendto = $attendees->thirdparty->name . '<' . trim($attendees->email) . '>'; // Define $sendtocc - $receivercc = $_POST['receivercc']; + $receivercc = GETPOST('receivercc', 'alphawithlgt'); if (!is_array($receivercc)) { if ($receivercc == '-1') { $receivercc = array(); @@ -153,7 +153,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { } $tmparray = array(); if (trim($_POST['sendtocc'])) { - $tmparray[] = trim($_POST['sendtocc']); + $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt')); } $sendtocc = implode(',', $tmparray); @@ -177,17 +177,17 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { - $from = $obj->label . ' <' . $obj->email . '>'; + $from = dol_string_nospecial($obj->label, ' ', array(",")) . ' <' . $obj->email . '>'; } } else { - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; + $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")) . ' <' . GETPOST('frommail') . '>'; } $replyto = $from; $subject = GETPOST('subject', 'restricthtml'); $message = GETPOST('message', 'restricthtml'); - $sendtobcc = GETPOST('sendtoccc'); + $sendtobcc = GETPOST('sendtoccc', 'alphawithlgt'); // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object // Make substitution in email content diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f835e293f5f..00693469948 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -304,7 +304,6 @@ if (empty($reshook)) { $qty = "qtyl".$i.'_'.$j; } } else { - //var_dump(GETPOST($qty,'alpha')); var_dump($_POST); var_dump($batch);exit; //shipment line for product with no batch management and no multiple stock location if (GETPOST($qty, 'int') > 0) { $totalqty += price2num(GETPOST($qty, 'alpha'), 'MS'); @@ -473,7 +472,6 @@ if (empty($reshook)) { // } //} } elseif ($action == 'setdate_livraison' && $user->rights->expedition->creer) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index bfa48e9aa0f..2919a42bdb7 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -112,7 +112,6 @@ if (empty($reshook)) { } if ($action == 'setdatedelivery' && $user->rights->commande->creer) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 845b8852cc1..ee80c9bc24a 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -87,8 +87,8 @@ if ($action == 'add_payment') { // Read possible payments foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { - $amounts[$expensereport->fk_user_author] = price2num($_POST[$key]); - $total += price2num($_POST[$key]); + $amounts[$expensereport->fk_user_author] = price2num(GETPOST($key)); + $total += price2num(GETPOST($key)); } } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ae5629b733b..b07d68f8591 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -388,7 +388,7 @@ if ($step == 4 && $action == 'submitFormField') { $_SESSION["export_filtered_fields"] = array(); foreach ($objexport->array_export_TypeFields[0] as $code => $type) { // $code: s.fieldname $value: Text|Boolean|List:ccc $newcode = (string) preg_replace('/\./', '_', $code); - //print 'xxx '.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n
"; + //print 'xxx '.$code."=".$newcode."=".$type."=".GETPOST($newcode)."\n
"; $check = 'alphanohtml'; $filterqualified = 1; if (!GETPOSTISSET($newcode) || GETPOST($newcode, $check) == '') { @@ -1212,7 +1212,7 @@ if ($step == 5 && $datatoexport) { // Show existing generated documents // NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste - print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); + print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (GETPOST('model') ? GETPOST('model') : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); } llxFooter(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a58a62b5ffd..80f39e17730 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -265,9 +265,9 @@ if (empty($reshook)) { $error++; $action = 'create'; } - $array_options = $extrafields->getOptionalsFromPost($object->table_element); + //$array_options = $extrafields->getOptionalsFromPost($object->table_element); - $object->array_options = $array_options; + //$object->array_options = $array_options; $id = $object->create($user); @@ -1342,6 +1342,23 @@ if ($action == 'create') { print ''; // ancre pour retourner sur la ligne print dol_htmlentitiesbr($objp->description); + $objectline = new FichinterLigne($db); + $objectline->fetch($objp->rowid); + $objectline->fetch_optionals(); + + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (!empty($extrafields)) { + $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + + print ''; + // Date print '
'; @@ -1378,15 +1395,6 @@ if ($action == 'create') { } print ''; - - $line = new FichinterLigne($db); - $line->fetch($objp->rowid); - - $extrafields->fetch_name_optionals_label($line->table_element); - - $line->fetch_optionals(); - - print $line->showOptionals($extrafields, 'view', array('colspan'=>5)); } // Line in update mode @@ -1405,6 +1413,22 @@ if ($action == 'create') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('np_desc', $objp->description, '', 164, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); $doleditor->Create(); + + $objectline = new FichinterLigne($db); + $objectline->fetch($objp->rowid); + $objectline->fetch_optionals(); + + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (!empty($extrafields)) { + $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + print ''; // Date d'intervention @@ -1431,14 +1455,6 @@ if ($action == 'create') { print ''; print ''; print ''."\n"; - - $line = new FichinterLigne($db); - $line->fetch($objp->rowid); - - $extrafields->fetch_name_optionals_label($line->table_element); - $line->fetch_optionals(); - - print $line->showOptionals($extrafields, 'edit', array('colspan'=>5)); } $i++; @@ -1481,6 +1497,20 @@ if ($action == 'create') { $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); $doleditor->Create(); } + + $objectline = new FichinterLigne($db); + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (is_object($objectline)) { + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + print ''; // Date intervention @@ -1513,14 +1543,6 @@ if ($action == 'create') { print ''; print ''; - //Line extrafield - - $lineadd = new FichinterLigne($db); - - $extrafields->fetch_name_optionals_label($lineadd->table_element); - - print $lineadd->showOptionals($extrafields, 'edit', array('colspan'=>5)); - if (!$num) { print '
'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR) ?dol_print_date($db->jdate($objp->date_intervention), 'dayhour') : dol_print_date($db->jdate($objp->date_intervention), 'day')).'
'; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ed978010a33..8a0e0de299e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3132,18 +3132,19 @@ class CommandeFournisseur extends CommonOrder $outputlangs->load("products"); if (!dol_strlen($modele)) { - $modele = 'muscadet'; - + $modele = ''; if ($this->model_pdf) { $modele = $this->model_pdf; } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } - - $modelpath = "core/modules/supplier_order/doc/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + if (empty($modele)) { + return 0; + } else { + $modelpath = "core/modules/supplier_order/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } } /** diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 35e5257fce0..c7a937518d7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1707,12 +1707,12 @@ if ($action == 'create') { // Payment term print ''.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); + $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id'); print ''; // Payment mode print ''.$langs->trans('PaymentMode').''; - $form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); print ''; // Planned delivery date diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index f93e51dc850..ca9bd1b3065 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -305,8 +305,8 @@ if ($action == 'dispatch' && $permissiontoreceive) { $pu = 'pu_'.$reg[1].'_'.$reg[2]; $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 59c3a57c4ac..e5cc12fe1c4 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1532,9 +1532,7 @@ if ($resql) { $projectstatic = new Project($db); $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val'] = array(); + $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array()); $totalarray['val']['cf.total_ht'] = 0; $totalarray['val']['cf.total_ttc'] = 0; while ($i < min($num, $limit)) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4b052981955..d384f3f90d2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -990,7 +990,7 @@ if (empty($reshook)) { if (!$error && GETPOST('origin', 'alpha') && GETPOST('originid')) { // Parse element/subelement (ex: project_task) $element = $subelement = GETPOST('origin', 'alpha'); - /*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs)) + /*if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'),$regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -1954,7 +1954,7 @@ if ($action == 'create') { $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); - $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); $datedue = ($datetmp == '' ?-1 : $datetmp); // Replicate extrafields @@ -1967,7 +1967,7 @@ if ($action == 'create') { $fk_account = $societe->fk_account; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); - $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); $datedue = ($datetmp == '' ?-1 : $datetmp); if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { @@ -2110,7 +2110,7 @@ if ($action == 'create') { } // Ref supplier - print ''.$langs->trans('RefSupplier').''.$langs->trans('RefSupplier').'id > 0) { print ' autofocus'; } @@ -2203,8 +2203,9 @@ if ($action == 'create') { foreach ($facids as $facparam) { $options .= ''; @@ -2446,7 +2447,7 @@ if ($action == 'create') { if (!empty($conf->intracommreport->enabled)) { $langs->loadLangs(array("intracommreport")); print ''.$langs->trans('IntracommReportTransportMode').''; - $form->selectTransportMode(isset($_POST['transport_mode_id']) ? $_POST['transport_mode_id'] : $transport_mode_id, 'transport_mode_id'); + $form->selectTransportMode(GETPOSTISSET('transport_mode_id') ? GETPOST('transport_mode_id') : $transport_mode_id, 'transport_mode_id'); print ''; } diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 927cc5f36b9..387e3fc39b8 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -46,6 +46,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercardcontact')); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 34255541c01..e08449b376b 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -51,6 +51,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercarddocument')); // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index f17d3c3e127..42031bc7fd9 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -44,6 +44,7 @@ if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$hookmanager->initHooks(array('invoicesuppliercardinfo')); $object = new FactureFournisseur($db); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index d59aefe7831..3b14dfeaf28 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -69,7 +69,7 @@ if (empty($reshook)) { // Set label if ($action == 'setlabel' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - $object->label = $_POST['label']; + $object->label = GETPOST('label'); $result = $object->update($user); if ($result < 0) { dol_print_error($db); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6dc609041c8..4b6e5bf151c 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -187,7 +187,7 @@ if (empty($reshook)) { } } - $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => $_POST[$key]); + $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => GETPOST($key)); } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { $cursorfacid = substr($key, 21); $multicurrency_amounts[$cursorfacid] = (GETPOST($key) ? price2num(GETPOST($key)) : 0); @@ -219,7 +219,7 @@ if (empty($reshook)) { } // Check parameters - if ($_POST['paiementid'] <= 0) { + if (GETPOST('paiementid') <= 0) { setEventMessages($langs->transnoentities('ErrorFieldRequired', $langs->transnoentities('PaymentMode')), null, 'errors'); $error++; } @@ -494,7 +494,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print $form->selectDate($dateinvoice, '', '', '', 0, "addpaiement", 1, 1, 0, '', '', $object->date); print ''; print ''.$langs->trans('PaymentMode').''; - $form->select_types_paiements(empty($_POST['paiementid']) ? $obj->fk_mode_reglement : $_POST['paiementid'], 'paiementid'); + $form->select_types_paiements(!GETPOST('paiementid') ? $obj->fk_mode_reglement : GETPOST('paiementid'), 'paiementid'); print ''; if (!empty($conf->banque->enabled)) { print ''.$langs->trans('Account').''; @@ -504,10 +504,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { print ' '; } - print ''.$langs->trans('Numero').''; + print ''.$langs->trans('Numero').''; print ''.$langs->trans('Comments').''; print ''; - print ''; + print ''; print ''; print dol_get_fiche_end(); @@ -683,10 +683,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); } print ''; - print ''; + print ''; } else { - print ''; - print ''; + print ''; + print ''; } } print ""; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index f8f484f0cc9..1f421230bbb 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -108,9 +108,9 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && } } -if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) { +if ($action == 'setnum_paiement' && GETPOST('num_paiement')) { $object->fetch($id); - $res = $object->update_num($_POST['num_paiement']); + $res = $object->update_num(GETPOST('num_paiement')); if ($res === 0) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); } else { @@ -118,7 +118,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) { } } -if ($action == 'setdatep' && !empty($_POST['datepday'])) { +if ($action == 'setdatep' && GETPOST('datepday')) { $object->fetch($id); $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); $res = $object->update_date($datepaye); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index fb53811aeaf..d8643c0783b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -112,7 +112,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'holiday', $object->id, 'holiday'); +$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut); /* @@ -654,7 +654,7 @@ if (empty($reshook)) { } if ($action == 'confirm_refuse' && GETPOST('confirm', 'alpha') == 'yes') { - if (!empty($_POST['detail_refuse'])) { + if (GETPOST('detail_refuse')) { $object->fetch($id); // If status pending validation and validator = user @@ -1414,7 +1414,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { // Confirmation messages if ($action == 'delete') { - if ($user->rights->holiday->delete) { + if ($candelete) { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1); } } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 621443fb408..12a32ba3f50 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -145,7 +145,8 @@ if (empty($reshook)) { } //If the user set a comment, we add it to the log comment - $comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : ''); + $note_holiday = GETPOST('note_holiday'); + $comment = ((isset($note_holiday[$userID]) && !empty($note_holiday[$userID])) ? ' ('.$note_holiday[$userID].')' : ''); //print 'holiday: '.$val['rowid'].'-'.$userValue; if ($userValue != '') { diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 8c51d667f9e..f83fa5901d8 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -109,7 +109,7 @@ class Position extends CommonObject 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), - 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,), + 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), @@ -843,6 +843,77 @@ class Position extends CommonObject } /** + * Return HTML string to put an input field into a page + * Code very similar with showInputField of extra fields + * + * @param array $val Array of properties for field to show + * @param string $key Key of attribute + * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @param int $nonewbutton Do not show new button + * @return string + */ + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) + { + global $langs; + + if ($key == 'fk_user') { + $vacantId = $keyprefix.$key.'vacant'.$keysuffix; + + $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + $out .= ''; + + ?> + + fk_user == 0) { + return $langs->trans("VacantPosition"); + } + return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + } + + + /** * Load the info information in the object * * @param int $id Id of object @@ -1072,7 +1143,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; class PositionLine extends CommonObjectLine { // To complete with content of an object PositionLine - // We should have a field rowid, fk_position and position + // We should have a field rowid , fk_position and position /** * @var int Does object support extrafields ? 0=No, 1=Yes diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 448538c39a8..724c14b93c0 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -853,7 +853,7 @@ class Skill extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action, $hookmanager; - $hookmanager->initHooks(array('jobdao')); + $hookmanager->initHooks(array('skilldao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 0ce7d793003..1fe67dd0bd1 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -135,14 +135,14 @@ if ($action == 'confirm_delete' && $confirm == "yes") { $result = $object->update($user); if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); } } } else { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } } diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 8aeadeaa18c..7b0b7bcfd7d 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -269,9 +269,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print ''."\n"; // Common attributes diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 6bfafcc1269..0d966e67416 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -189,18 +189,13 @@ if ($object->id > 0) { } - print '
'; - if (!empty($conf->agenda->enabled)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; - } else { - print ''.$langs->trans("AddAction").''; + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } } - print '
'; - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { @@ -211,7 +206,7 @@ if ($object->id > 0) { } - //print load_fiche_titre($langs->trans("ActionsOnJob"), '', ''); + print load_fiche_titre($langs->trans("ActionsOnJob"), $newcardbutton, ''); // List of all actions $filters = array(); diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index d4501c8e685..906eb83b945 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -195,9 +195,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index d36d352e895..19749d94c19 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -915,9 +915,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index d6ed72c2612..1585ed1e03f 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -270,6 +270,10 @@ foreach ($search as $key => $val) { } } } +$vacant = GETPOST('search_fk_uservacant', 'alphanohtml') === 'on'; +if ($vacant) { + $sql .= ' AND t.fk_user = 0'; +} if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index a06cf40952a..45e2bfea16a 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -196,9 +196,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
' . "\n"; // Common attributes diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 41059a45e92..01f152f1ea5 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); $updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array()); $separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ',')); $enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); +$separator_used = str_replace('\t', "\t", $separator); $objimport = new Import($db); $objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport)); @@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } if ($model == 'xlsx') { @@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } @@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index 7e12c501403..5fc00e57f75 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -108,17 +108,17 @@ */ // TCPDF configuration -require_once(dirname(__FILE__).'/tcpdf_autoconfig.php'); +require_once dirname(__FILE__).'/tcpdf_autoconfig.php'; // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_font_data.php'); +require_once dirname(__FILE__).'/include/tcpdf_font_data.php'; // TCPDF static font methods and data -require_once(dirname(__FILE__).'/include/tcpdf_fonts.php'); +require_once dirname(__FILE__).'/include/tcpdf_fonts.php'; // TCPDF static color methods and data -require_once(dirname(__FILE__).'/include/tcpdf_colors.php'); +require_once dirname(__FILE__).'/include/tcpdf_colors.php'; // TCPDF static image methods and data -require_once(dirname(__FILE__).'/include/tcpdf_images.php'); +require_once dirname(__FILE__).'/include/tcpdf_images.php'; // TCPDF static methods and data -require_once(dirname(__FILE__).'/include/tcpdf_static.php'); +require_once dirname(__FILE__).'/include/tcpdf_static.php'; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -134,7 +134,8 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * @IgnoreAnnotation("public") * @IgnoreAnnotation("pre") */ -class TCPDF { +class TCPDF +{ // Protected properties @@ -1852,7 +1853,8 @@ class TCPDF { * @public * @see getPageSizeFromFormat(), setPageFormat() */ - public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false) { + public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false) + { /* Set internal character encoding to ASCII */ if (function_exists('mb_internal_encoding') AND mb_internal_encoding()) { $this->internal_encoding = mb_internal_encoding(); @@ -1869,8 +1871,7 @@ class TCPDF { if ($pdfa != false) { $this->pdfa_mode = true; $this->pdfa_version = $pdfa; // 1 or 3 - } else - $this->pdfa_mode = false; + } else $this->pdfa_mode = false; $this->force_srgb = false; // set language direction @@ -2017,7 +2018,8 @@ class TCPDF { * @public * @since 1.53.0.TC016 */ - public function __destruct() { + public function __destruct() + { // cleanup $this->_destroy(true); } @@ -2028,7 +2030,8 @@ class TCPDF { * @public * @since 3.0.015 (2008-06-06) */ - public function setPageUnit($unit) { + public function setPageUnit($unit) + { $unit = strtolower($unit); //Set scale factor switch ($unit) { @@ -2068,59 +2071,60 @@ class TCPDF { /** * Change the format of the current page * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() documentation or an array of two numbers (width, height) or an array containing the following measures and options:
    - *
  • ['format'] = page format name (one of the above);
  • - *
  • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • - *
  • ['PZ'] : The page's preferred zoom (magnification) factor.
  • - *
  • ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
  • - *
  • ['MediaBox']['llx'] : lower-left x coordinate
  • - *
  • ['MediaBox']['lly'] : lower-left y coordinate
  • - *
  • ['MediaBox']['urx'] : upper-right x coordinate
  • - *
  • ['MediaBox']['ury'] : upper-right y coordinate
  • - *
  • ['CropBox'] : the visible region of default user space:
  • - *
  • ['CropBox']['llx'] : lower-left x coordinate
  • - *
  • ['CropBox']['lly'] : lower-left y coordinate
  • - *
  • ['CropBox']['urx'] : upper-right x coordinate
  • - *
  • ['CropBox']['ury'] : upper-right y coordinate
  • - *
  • ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
  • - *
  • ['BleedBox']['llx'] : lower-left x coordinate
  • - *
  • ['BleedBox']['lly'] : lower-left y coordinate
  • - *
  • ['BleedBox']['urx'] : upper-right x coordinate
  • - *
  • ['BleedBox']['ury'] : upper-right y coordinate
  • - *
  • ['TrimBox'] : the intended dimensions of the finished page after trimming:
  • - *
  • ['TrimBox']['llx'] : lower-left x coordinate
  • - *
  • ['TrimBox']['lly'] : lower-left y coordinate
  • - *
  • ['TrimBox']['urx'] : upper-right x coordinate
  • - *
  • ['TrimBox']['ury'] : upper-right y coordinate
  • - *
  • ['ArtBox'] : the extent of the page's meaningful content:
  • - *
  • ['ArtBox']['llx'] : lower-left x coordinate
  • - *
  • ['ArtBox']['lly'] : lower-left y coordinate
  • - *
  • ['ArtBox']['urx'] : upper-right x coordinate
  • - *
  • ['ArtBox']['ury'] : upper-right y coordinate
  • - *
  • ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
  • - *
  • ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
  • - *
  • ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
  • - *
  • ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
  • - *
  • ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
  • - *
  • ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
  • - *
  • ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
  • - *
  • ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
  • - *
  • ['trans']['D'] : The duration of the transition effect, in seconds.
  • - *
  • ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
  • - *
  • ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
  • - *
  • ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
  • - *
  • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
  • - *
  • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • - *
+ *
  • ['format'] = page format name (one of the above);
  • + *
  • ['Rotate'] : The number of degrees by which the page shall be rotated clockwise when displayed or printed. The value shall be a multiple of 90.
  • + *
  • ['PZ'] : The page's preferred zoom (magnification) factor.
  • + *
  • ['MediaBox'] : the boundaries of the physical medium on which the page shall be displayed or printed:
  • + *
  • ['MediaBox']['llx'] : lower-left x coordinate
  • + *
  • ['MediaBox']['lly'] : lower-left y coordinate
  • + *
  • ['MediaBox']['urx'] : upper-right x coordinate
  • + *
  • ['MediaBox']['ury'] : upper-right y coordinate
  • + *
  • ['CropBox'] : the visible region of default user space:
  • + *
  • ['CropBox']['llx'] : lower-left x coordinate
  • + *
  • ['CropBox']['lly'] : lower-left y coordinate
  • + *
  • ['CropBox']['urx'] : upper-right x coordinate
  • + *
  • ['CropBox']['ury'] : upper-right y coordinate
  • + *
  • ['BleedBox'] : the region to which the contents of the page shall be clipped when output in a production environment:
  • + *
  • ['BleedBox']['llx'] : lower-left x coordinate
  • + *
  • ['BleedBox']['lly'] : lower-left y coordinate
  • + *
  • ['BleedBox']['urx'] : upper-right x coordinate
  • + *
  • ['BleedBox']['ury'] : upper-right y coordinate
  • + *
  • ['TrimBox'] : the intended dimensions of the finished page after trimming:
  • + *
  • ['TrimBox']['llx'] : lower-left x coordinate
  • + *
  • ['TrimBox']['lly'] : lower-left y coordinate
  • + *
  • ['TrimBox']['urx'] : upper-right x coordinate
  • + *
  • ['TrimBox']['ury'] : upper-right y coordinate
  • + *
  • ['ArtBox'] : the extent of the page's meaningful content:
  • + *
  • ['ArtBox']['llx'] : lower-left x coordinate
  • + *
  • ['ArtBox']['lly'] : lower-left y coordinate
  • + *
  • ['ArtBox']['urx'] : upper-right x coordinate
  • + *
  • ['ArtBox']['ury'] : upper-right y coordinate
  • + *
  • ['BoxColorInfo'] :specify the colours and other visual characteristics that should be used in displaying guidelines on the screen for each of the possible page boundaries other than the MediaBox:
  • + *
  • ['BoxColorInfo'][BOXTYPE]['C'] : an array of three numbers in the range 0-255, representing the components in the DeviceRGB colour space.
  • + *
  • ['BoxColorInfo'][BOXTYPE]['W'] : the guideline width in default user units
  • + *
  • ['BoxColorInfo'][BOXTYPE]['S'] : the guideline style: S = Solid; D = Dashed
  • + *
  • ['BoxColorInfo'][BOXTYPE]['D'] : dash array defining a pattern of dashes and gaps to be used in drawing dashed guidelines
  • + *
  • ['trans'] : the style and duration of the visual transition to use when moving from another page to the given page during a presentation
  • + *
  • ['trans']['Dur'] : The page's display duration (also called its advance timing): the maximum length of time, in seconds, that the page shall be displayed during presentations before the viewer application shall automatically advance to the next page.
  • + *
  • ['trans']['S'] : transition style : Split, Blinds, Box, Wipe, Dissolve, Glitter, R, Fly, Push, Cover, Uncover, Fade
  • + *
  • ['trans']['D'] : The duration of the transition effect, in seconds.
  • + *
  • ['trans']['Dm'] : (Split and Blinds transition styles only) The dimension in which the specified transition effect shall occur: H = Horizontal, V = Vertical. Default value: H.
  • + *
  • ['trans']['M'] : (Split, Box and Fly transition styles only) The direction of motion for the specified transition effect: I = Inward from the edges of the page, O = Outward from the center of the pageDefault value: I.
  • + *
  • ['trans']['Di'] : (Wipe, Glitter, Fly, Cover, Uncover and Push transition styles only) The direction in which the specified transition effect shall moves, expressed in degrees counterclockwise starting from a left-to-right direction. If the value is a number, it shall be one of: 0 = Left to right, 90 = Bottom to top (Wipe only), 180 = Right to left (Wipe only), 270 = Top to bottom, 315 = Top-left to bottom-right (Glitter only). If the value is a name, it shall be None, which is relevant only for the Fly transition when the value of SS is not 1.0. Default value: 0.
  • + *
  • ['trans']['SS'] : (Fly transition style only) The starting or ending scale at which the changes shall be drawn. If M specifies an inward transition, the scale of the changes drawn shall progress from SS to 1.0 over the course of the transition. If M specifies an outward transition, the scale of the changes drawn shall progress from 1.0 to SS over the course of the transition. Default: 1.0.
  • + *
  • ['trans']['B'] : (Fly transition style only) If true, the area that shall be flown in is rectangular and opaque. Default: false.
  • + * * @param $orientation (string) page orientation. Possible values are (case insensitive):
      - *
    • P or Portrait (default)
    • - *
    • L or Landscape
    • - *
    • '' (empty string) for automatic orientation
    • - *
    + *
  • P or Portrait (default)
  • + *
  • L or Landscape
  • + *
  • '' (empty string) for automatic orientation
  • + * * @protected * @since 3.0.015 (2008-06-06) * @see getPageSizeFromFormat() */ - protected function setPageFormat($format, $orientation='P') { + protected function setPageFormat($format, $orientation = 'P') + { if (!empty($format) AND isset($this->pagedim[$this->page])) { // remove inherited values unset($this->pagedim[$this->page]); @@ -2234,7 +2238,8 @@ class TCPDF { * @public * @since 3.0.015 (2008-06-06) */ - public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') { + public function setPageOrientation($orientation, $autopagebreak = '', $bottommargin = '') + { if (!isset($this->pagedim[$this->page]['MediaBox'])) { // the boundaries of the physical medium on which the page shall be displayed or printed $this->pagedim = TCPDF_STATIC::setPageBoxes($this->page, 'MediaBox', 0, 0, $this->fwPt, $this->fhPt, true, $this->k, $this->pagedim); @@ -2285,7 +2290,7 @@ class TCPDF { $this->wPt = $this->fwPt; $this->hPt = $this->fhPt; } - if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)){ + if ((abs($this->pagedim[$this->page]['MediaBox']['urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page]['MediaBox']['ury'] - $this->wPt) < $this->feps)) { // swap X and Y coordinates (change page orientation) $this->pagedim = TCPDF_STATIC::swapPageBoxCoordinates($this->page, $this->pagedim); } @@ -2340,7 +2345,8 @@ class TCPDF { * @public * @since 4.6.016 (2009-06-15) */ - public function setSpacesRE($re='/[^\S\xa0]/') { + public function setSpacesRE($re = '/[^\S\xa0]/') + { $this->re_spaces = $re; $re_parts = explode('/', $re); // get pattern parts @@ -2365,7 +2371,8 @@ class TCPDF { * @public * @since 2.0.000 (2008-01-03) */ - public function setRTL($enable, $resetx=true) { + public function setRTL($enable, $resetx = true) + { $enable = $enable ? true : false; $resetx = ($resetx AND ($enable != $this->rtl)); $this->rtl = $enable; @@ -2381,7 +2388,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getRTL() { + public function getRTL() + { return $this->rtl; } @@ -2391,7 +2399,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-09) */ - public function setTempRTL($mode) { + public function setTempRTL($mode) + { $newmode = false; switch (strtoupper($mode)) { case 'LTR': @@ -2423,7 +2432,8 @@ class TCPDF { * @public * @since 4.8.014 (2009-11-04) */ - public function isRTLTextDir() { + public function isRTLTextDir() + { return ($this->rtl OR ($this->tmprtl == 'R')); } @@ -2434,7 +2444,8 @@ class TCPDF { * @public * @since 1.53.0.TC034 */ - public function setLastH($h) { + public function setLastH($h) + { $this->lasth = $h; } @@ -2444,7 +2455,8 @@ class TCPDF { * @param $padding (boolean) If true add cell padding * @public */ - public function getCellHeight($fontsize, $padding=TRUE) { + public function getCellHeight($fontsize, $padding = true) + { $height = ($fontsize * $this->cell_height_ratio); if ($padding) { $height += ($this->cell_padding['T'] + $this->cell_padding['B']); @@ -2457,7 +2469,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-03) */ - public function resetLastH() { + public function resetLastH() + { $this->lasth = $this->getCellHeight($this->FontSize); } @@ -2467,7 +2480,8 @@ class TCPDF { * @public * @since 4.0.017 (2008-08-05) */ - public function getLastH() { + public function getLastH() + { return $this->lasth; } @@ -2478,7 +2492,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function setImageScale($scale) { + public function setImageScale($scale) + { $this->imgscale = $scale; } @@ -2489,7 +2504,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function getImageScale() { + public function getImageScale() + { return $this->imgscale; } @@ -2502,7 +2518,8 @@ class TCPDF { * @public * @since 4.5.027 (2009-03-16) */ - public function getPageDimensions($pagenum='') { + public function getPageDimensions($pagenum = '') + { if (empty($pagenum)) { $pagenum = $this->page; } @@ -2518,7 +2535,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getPageWidth($pagenum='') { + public function getPageWidth($pagenum = '') + { if (empty($pagenum)) { return $this->w; } @@ -2534,7 +2552,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getPageHeight($pagenum='') { + public function getPageHeight($pagenum = '') + { if (empty($pagenum)) { return $this->h; } @@ -2550,7 +2569,8 @@ class TCPDF { * @since 1.5.2 * @see getPageDimensions() */ - public function getBreakMargin($pagenum='') { + public function getBreakMargin($pagenum = '') + { if (empty($pagenum)) { return $this->bMargin; } @@ -2564,7 +2584,8 @@ class TCPDF { * @public * @since 1.5.2 */ - public function getScaleFactor() { + public function getScaleFactor() + { return $this->k; } @@ -2578,7 +2599,8 @@ class TCPDF { * @since 1.0 * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() */ - public function SetMargins($left, $top, $right=-1, $keepmargins=false) { + public function SetMargins($left, $top, $right = -1, $keepmargins = false) + { //Set left, top and right margins $this->lMargin = $left; $this->tMargin = $top; @@ -2600,7 +2622,8 @@ class TCPDF { * @since 1.4 * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetLeftMargin($margin) { + public function SetLeftMargin($margin) + { //Set left margin $this->lMargin = $margin; if (($this->page > 0) AND ($this->x < $margin)) { @@ -2615,7 +2638,8 @@ class TCPDF { * @since 1.5 * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetTopMargin($margin) { + public function SetTopMargin($margin) + { //Set top margin $this->tMargin = $margin; if (($this->page > 0) AND ($this->y < $margin)) { @@ -2630,7 +2654,8 @@ class TCPDF { * @since 1.5 * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() */ - public function SetRightMargin($margin) { + public function SetRightMargin($margin) + { $this->rMargin = $margin; if (($this->page > 0) AND ($this->x > ($this->w - $margin))) { $this->x = $this->w - $margin; @@ -2644,7 +2669,8 @@ class TCPDF { * @since 2.1.000 (2008-01-09) * @see getCellPaddings(), setCellPaddings() */ - public function SetCellPadding($pad) { + public function SetCellPadding($pad) + { if ($pad >= 0) { $this->cell_padding['L'] = $pad; $this->cell_padding['T'] = $pad; @@ -2663,7 +2689,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see getCellPaddings(), SetCellPadding() */ - public function setCellPaddings($left='', $top='', $right='', $bottom='') { + public function setCellPaddings($left = '', $top = '', $right = '', $bottom = '') + { if (($left !== '') AND ($left >= 0)) { $this->cell_padding['L'] = $left; } @@ -2685,7 +2712,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see setCellPaddings(), SetCellPadding() */ - public function getCellPaddings() { + public function getCellPaddings() + { return $this->cell_padding; } @@ -2699,7 +2727,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see getCellMargins() */ - public function setCellMargins($left='', $top='', $right='', $bottom='') { + public function setCellMargins($left = '', $top = '', $right = '', $bottom = '') + { if (($left !== '') AND ($left >= 0)) { $this->cell_margin['L'] = $left; } @@ -2721,7 +2750,8 @@ class TCPDF { * @since 5.9.000 (2010-10-03) * @see setCellMargins() */ - public function getCellMargins() { + public function getCellMargins() + { return $this->cell_margin; } @@ -2732,7 +2762,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-03) */ - protected function adjustCellPadding($brd=0) { + protected function adjustCellPadding($brd = 0) + { if (empty($brd)) { return; } @@ -2783,16 +2814,16 @@ class TCPDF { } } // correct internal cell padding if required to avoid overlap between text and lines - if ((strpos($border,'T') !== false) AND ($this->cell_padding['T'] < $adj)) { + if ((strpos($border, 'T') !== false) AND ($this->cell_padding['T'] < $adj)) { $this->cell_padding['T'] = $adj; } - if ((strpos($border,'R') !== false) AND ($this->cell_padding['R'] < $adj)) { + if ((strpos($border, 'R') !== false) AND ($this->cell_padding['R'] < $adj)) { $this->cell_padding['R'] = $adj; } - if ((strpos($border,'B') !== false) AND ($this->cell_padding['B'] < $adj)) { + if ((strpos($border, 'B') !== false) AND ($this->cell_padding['B'] < $adj)) { $this->cell_padding['B'] = $adj; } - if ((strpos($border,'L') !== false) AND ($this->cell_padding['L'] < $adj)) { + if ((strpos($border, 'L') !== false) AND ($this->cell_padding['L'] < $adj)) { $this->cell_padding['L'] = $adj; } } @@ -2807,7 +2838,8 @@ class TCPDF { * @since 1.0 * @see Cell(), MultiCell(), AcceptPageBreak() */ - public function SetAutoPageBreak($auto, $margin=0) { + public function SetAutoPageBreak($auto, $margin = 0) + { $this->AutoPageBreak = $auto ? true : false; $this->bMargin = $margin; $this->PageBreakTrigger = $this->h - $margin; @@ -2819,7 +2851,8 @@ class TCPDF { * @public * @since 5.9.088 */ - public function getAutoPageBreak() { + public function getAutoPageBreak() + { return $this->AutoPageBreak; } @@ -2831,7 +2864,8 @@ class TCPDF { * @public * @since 1.2 */ - public function SetDisplayMode($zoom, $layout='SinglePage', $mode='UseNone') { + public function SetDisplayMode($zoom, $layout = 'SinglePage', $mode = 'UseNone') + { if (($zoom == 'fullpage') OR ($zoom == 'fullwidth') OR ($zoom == 'real') OR ($zoom == 'default') OR (!is_string($zoom))) { $this->ZoomMode = $zoom; } else { @@ -2848,7 +2882,8 @@ class TCPDF { * @public * @since 1.4 */ - public function SetCompression($compress=true) { + public function SetCompression($compress = true) + { $this->compress = false; if (function_exists('gzcompress')) { if ($compress) { @@ -2865,7 +2900,8 @@ class TCPDF { * @public * @since 5.9.121 (2011-09-28) */ - public function setSRGBmode($mode=false) { + public function setSRGBmode($mode = false) + { $this->force_srgb = $mode ? true : false; } @@ -2876,7 +2912,8 @@ class TCPDF { * @since 5.9.027 (2010-12-01) * @public */ - public function SetDocInfoUnicode($unicode=true) { + public function SetDocInfoUnicode($unicode = true) + { $this->docinfounicode = $unicode ? true : false; } @@ -2887,7 +2924,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() */ - public function SetTitle($title) { + public function SetTitle($title) + { $this->title = $title; } @@ -2898,7 +2936,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() */ - public function SetSubject($subject) { + public function SetSubject($subject) + { $this->subject = $subject; } @@ -2909,7 +2948,8 @@ class TCPDF { * @since 1.2 * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetAuthor($author) { + public function SetAuthor($author) + { $this->author = $author; } @@ -2920,7 +2960,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle() */ - public function SetKeywords($keywords) { + public function SetKeywords($keywords) + { $this->keywords = $keywords; } @@ -2931,7 +2972,8 @@ class TCPDF { * @since 1.2 * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() */ - public function SetCreator($creator) { + public function SetCreator($creator) + { $this->creator = $creator; } @@ -2941,7 +2983,8 @@ class TCPDF { * @public * @since 1.0 */ - public function Error($msg) { + public function Error($msg) + { // unset all class variables $this->_destroy(true); if (defined('K_TCPDF_THROW_EXCEPTION_ERROR') AND !K_TCPDF_THROW_EXCEPTION_ERROR) { @@ -2959,7 +3002,8 @@ class TCPDF { * @since 1.0 * @see AddPage(), Close() */ - public function Open() { + public function Open() + { $this->state = 1; } @@ -2971,7 +3015,8 @@ class TCPDF { * @since 1.0 * @see Open(), Output() */ - public function Close() { + public function Close() + { if ($this->state == 3) { return; } @@ -3015,7 +3060,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see getPage(), lastpage(), getNumPages() */ - public function setPage($pnum, $resetmargins=false) { + public function setPage($pnum, $resetmargins = false) + { if (($pnum == $this->page) AND ($this->state == 2)) { return; } @@ -3062,7 +3108,8 @@ class TCPDF { * @since 2.0.000 (2008-01-04) * @see setPage(), getPage(), getNumPages() */ - public function lastPage($resetmargins=false) { + public function lastPage($resetmargins = false) + { $this->setPage($this->getNumPages(), $resetmargins); } @@ -3073,7 +3120,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see setPage(), lastpage(), getNumPages() */ - public function getPage() { + public function getPage() + { return $this->page; } @@ -3084,7 +3132,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see setPage(), getPage(), lastpage() */ - public function getNumPages() { + public function getNumPages() + { return $this->numpages; } @@ -3097,7 +3146,8 @@ class TCPDF { * @since 5.0.001 (2010-05-06) * @see AddPage(), startPage(), endPage(), endTOCPage() */ - public function addTOCPage($orientation='', $format='', $keepmargins=false) { + public function addTOCPage($orientation = '', $format = '', $keepmargins = false) + { $this->AddPage($orientation, $format, $keepmargins, true); } @@ -3107,7 +3157,8 @@ class TCPDF { * @since 5.0.001 (2010-05-06) * @see AddPage(), startPage(), endPage(), addTOCPage() */ - public function endTOCPage() { + public function endTOCPage() + { $this->endPage(true); } @@ -3122,7 +3173,8 @@ class TCPDF { * @since 1.0 * @see startPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() */ - public function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) { + public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) + { if ($this->inxobj) { // we are inside an XObject template return; @@ -3146,7 +3198,8 @@ class TCPDF { * @since 4.2.010 (2008-11-14) * @see AddPage(), startPage(), addTOCPage(), endTOCPage() */ - public function endPage($tocpage=false) { + public function endPage($tocpage = false) + { // check if page is already closed if (($this->page == 0) OR ($this->numpages > $this->page) OR (!$this->pageopen[$this->page])) { return; @@ -3172,7 +3225,8 @@ class TCPDF { * @see AddPage(), endPage(), addTOCPage(), endTOCPage(), getPageSizeFromFormat(), setPageFormat() * @public */ - public function startPage($orientation='', $format='', $tocpage=false) { + public function startPage($orientation = '', $format = '', $tocpage = false) + { if ($tocpage) { $this->tocpage = true; } @@ -3243,7 +3297,8 @@ class TCPDF { * @public * @since 4.0.016 (2008-07-30) */ - public function setPageMark() { + public function setPageMark() + { $this->intmrk[$this->page] = $this->pagelen[$this->page]; $this->bordermrk[$this->page] = $this->intmrk[$this->page]; $this->setContentMark(); @@ -3256,7 +3311,8 @@ class TCPDF { * @protected * @since 4.6.021 (2009-07-20) */ - protected function setContentMark($page=0) { + protected function setContentMark($page = 0) + { if ($page <= 0) { $page = $this->page; } @@ -3277,7 +3333,8 @@ class TCPDF { * @param $lc (array) RGB array color for line. * @public */ - public function setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0,0,0), $lc=array(0,0,0)) { + public function setHeaderData($ln = '', $lw = 0, $ht = '', $hs = '', $tc = array(0,0,0), $lc = array(0,0,0)) + { $this->header_logo = $ln; $this->header_logo_width = $lw; $this->header_title = $ht; @@ -3292,7 +3349,8 @@ class TCPDF { * @param $lc (array) RGB array color for line. * @public */ - public function setFooterData($tc=array(0,0,0), $lc=array(0,0,0)) { + public function setFooterData($tc = array(0,0,0), $lc = array(0,0,0)) + { $this->footer_text_color = $tc; $this->footer_line_color = $lc; } @@ -3304,7 +3362,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getHeaderData() { + public function getHeaderData() + { $ret = array(); $ret['logo'] = $this->header_logo; $ret['logo_width'] = $this->header_logo_width; @@ -3321,7 +3380,8 @@ class TCPDF { * @param $hm (int) distance in user units * @public */ - public function setHeaderMargin($hm=10) { + public function setHeaderMargin($hm = 10) + { $this->header_margin = $hm; } @@ -3331,7 +3391,8 @@ class TCPDF { * @since 4.0.012 (2008-07-24) * @public */ - public function getHeaderMargin() { + public function getHeaderMargin() + { return $this->header_margin; } @@ -3341,7 +3402,8 @@ class TCPDF { * @param $fm (int) distance in user units * @public */ - public function setFooterMargin($fm=10) { + public function setFooterMargin($fm = 10) + { $this->footer_margin = $fm; } @@ -3351,7 +3413,8 @@ class TCPDF { * @since 4.0.012 (2008-07-24) * @public */ - public function getFooterMargin() { + public function getFooterMargin() + { return $this->footer_margin; } /** @@ -3359,7 +3422,8 @@ class TCPDF { * @param $val (boolean) set to true to print the page header (default), false otherwise. * @public */ - public function setPrintHeader($val=true) { + public function setPrintHeader($val = true) + { $this->print_header = $val ? true : false; } @@ -3368,7 +3432,8 @@ class TCPDF { * @param $val (boolean) set to true to print the page footer (default), false otherwise. * @public */ - public function setPrintFooter($val=true) { + public function setPrintFooter($val = true) + { $this->print_footer = $val ? true : false; } @@ -3377,7 +3442,8 @@ class TCPDF { * @return float * @public */ - public function getImageRBX() { + public function getImageRBX() + { return $this->img_rb_x; } @@ -3386,7 +3452,8 @@ class TCPDF { * @return float * @public */ - public function getImageRBY() { + public function getImageRBY() + { return $this->img_rb_y; } @@ -3394,7 +3461,8 @@ class TCPDF { * Reset the xobject template used by Header() method. * @public */ - public function resetHeaderTemplate() { + public function resetHeaderTemplate() + { $this->header_xobjid = false; } @@ -3403,7 +3471,8 @@ class TCPDF { * @param $val (boolean) set to true to reset Header xobject template at each page, false otherwise. * @public */ - public function setHeaderTemplateAutoreset($val=true) { + public function setHeaderTemplateAutoreset($val = true) + { $this->header_xobj_autoreset = $val ? true : false; } @@ -3412,7 +3481,8 @@ class TCPDF { * It is automatically called by AddPage() and could be overwritten in your own inherited class. * @public */ - public function Header() { + public function Header() + { if ($this->header_xobjid === false) { // start a new XObject Template $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin); @@ -3489,7 +3559,8 @@ class TCPDF { * It is automatically called by AddPage() and could be overwritten in your own inherited class. * @public */ - public function Footer() { + public function Footer() + { $cur_y = $this->y; $this->SetTextColorArray($this->footer_text_color); //set style for cell border @@ -3536,7 +3607,8 @@ class TCPDF { * @protected * @since 4.0.012 (2008-07-24) */ - protected function setHeader() { + protected function setHeader() + { if (!$this->print_header OR ($this->state != 2)) { return; } @@ -3577,7 +3649,8 @@ class TCPDF { * @protected * @since 4.0.012 (2008-07-24) */ - protected function setFooter() { + protected function setFooter() + { if ($this->state != 2) { return; } @@ -3633,7 +3706,8 @@ class TCPDF { * @protected * @since 5.9.091 (2011-06-15) */ - protected function inPageBody() { + protected function inPageBody() + { return (($this->InHeader === false) AND ($this->InFooter === false)); } @@ -3642,7 +3716,8 @@ class TCPDF { * @protected * @since 4.5.030 (2009-03-25) */ - protected function setTableHeader() { + protected function setTableHeader() + { if ($this->num_columns > 1) { // multi column mode return; @@ -3709,7 +3784,8 @@ class TCPDF { * @since 1.0 * @see getAliasNbPages() */ - public function PageNo() { + public function PageNo() + { return $this->page; } @@ -3719,7 +3795,8 @@ class TCPDF { * @public * @since 6.0.038 (2013-09-30) */ - public function getAllSpotColors() { + public function getAllSpotColors() + { return $this->spot_colors; } @@ -3736,7 +3813,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see SetDrawSpotColor(), SetFillSpotColor(), SetTextSpotColor() */ - public function AddSpotColor($name, $c, $m, $y, $k) { + public function AddSpotColor($name, $c, $m, $y, $k) + { if (!isset($this->spot_colors[$name])) { $i = (1 + count($this->spot_colors)); $this->spot_colors[$name] = array('C' => $c, 'M' => $m, 'Y' => $y, 'K' => $k, 'name' => $name, 'i' => $i); @@ -3752,7 +3830,8 @@ class TCPDF { * @public * @since 5.9.125 (2011-10-03) */ - public function setSpotColor($type, $name, $tint=100) { + public function setSpotColor($type, $name, $tint = 100) + { $spotcolor = TCPDF_COLORS::getSpotColor($name, $this->spot_colors); if ($spotcolor === false) { $this->Error('Undefined spot color: '.$name.', you must add it using the AddSpotColor() method.'); @@ -3798,7 +3877,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetFillSpotColor(), SetTextSpotColor() */ - public function SetDrawSpotColor($name, $tint=100) { + public function SetDrawSpotColor($name, $tint = 100) + { $this->setSpotColor('draw', $name, $tint); } @@ -3810,7 +3890,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetTextSpotColor() */ - public function SetFillSpotColor($name, $tint=100) { + public function SetFillSpotColor($name, $tint = 100) + { $this->setSpotColor('fill', $name, $tint); } @@ -3822,7 +3903,8 @@ class TCPDF { * @since 4.0.024 (2008-09-12) * @see AddSpotColor(), SetDrawSpotColor(), SetFillSpotColor() */ - public function SetTextSpotColor($name, $tint=100) { + public function SetTextSpotColor($name, $tint = 100) + { $this->setSpotColor('text', $name, $tint); } @@ -3837,7 +3919,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-11) */ - public function setColorArray($type, $color, $ret=false) { + public function setColorArray($type, $color, $ret = false) + { if (is_array($color)) { $color = array_values($color); // component: grey, RGB red or CMYK cyan @@ -3868,7 +3951,8 @@ class TCPDF { * @since 3.1.000 (2008-06-11) * @see SetDrawColor() */ - public function SetDrawColorArray($color, $ret=false) { + public function SetDrawColorArray($color, $ret = false) + { return $this->setColorArray('draw', $color, $ret); } @@ -3882,7 +3966,8 @@ class TCPDF { * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetFillColorArray($color, $ret=false) { + public function SetFillColorArray($color, $ret = false) + { return $this->setColorArray('fill', $color, $ret); } @@ -3895,7 +3980,8 @@ class TCPDF { * @since 3.1.000 (2008-6-11) * @see SetFillColor() */ - public function SetTextColorArray($color, $ret=false) { + public function SetTextColorArray($color, $ret = false) + { return $this->setColorArray('text', $color, $ret); } @@ -3912,7 +3998,8 @@ class TCPDF { * @public * @since 5.9.125 (2011-10-03) */ - public function setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function setColor($type, $col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { // set default values if (!is_numeric($col1)) { $col1 = 0; @@ -4002,7 +4089,8 @@ class TCPDF { * @since 1.3 * @see SetDrawColorArray(), SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() */ - public function SetDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetDrawColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('draw', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4019,7 +4107,8 @@ class TCPDF { * @since 1.3 * @see SetFillColorArray(), SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() */ - public function SetFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetFillColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('fill', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4036,7 +4125,8 @@ class TCPDF { * @since 1.3 * @see SetTextColorArray(), SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() */ - public function SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='') { + public function SetTextColor($col1 = 0, $col2 = -1, $col3 = -1, $col4 = -1, $ret = false, $name = '') + { return $this->setColor('text', $col1, $col2, $col3, $col4, $ret, $name); } @@ -4052,7 +4142,8 @@ class TCPDF { * @public * @since 1.2 */ - public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) { + public function GetStringWidth($s, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false) + { return $this->GetArrStringWidth(TCPDF_FONTS::utf8Bidi(TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont), $s, $this->tmprtl, $this->isunicode, $this->CurrentFont), $fontname, $fontstyle, $fontsize, $getarray); } @@ -4068,7 +4159,8 @@ class TCPDF { * @public * @since 2.4.000 (2008-03-06) */ - public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) { + public function GetArrStringWidth($sa, $fontname = '', $fontstyle = '', $fontsize = 0, $getarray = false) + { // store current values if (!TCPDF_STATIC::empty_string($fontname)) { $prev_FontFamily = $this->FontFamily; @@ -4107,7 +4199,8 @@ class TCPDF { * @public * @since 2.4.000 (2008-03-06) */ - public function GetCharWidth($char, $notlast=true) { + public function GetCharWidth($char, $notlast = true) + { // get raw width $chw = $this->getRawCharWidth($char); if (($this->font_spacing < 0) OR (($this->font_spacing > 0) AND $notlast)) { @@ -4129,7 +4222,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-09-28) */ - public function getRawCharWidth($char) { + public function getRawCharWidth($char) + { if ($char == 173) { // SHY character will not be printed return (0); @@ -4155,7 +4249,8 @@ class TCPDF { * @public * @since 2.0.0001 (2008-01-07) */ - public function GetNumChars($s) { + public function GetNumChars($s) + { if ($this->isUnicodeFont()) { return count(TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont)); } @@ -4167,7 +4262,8 @@ class TCPDF { * @protected * @since 4.0.013 (2008-07-28) */ - protected function getFontsList() { + protected function getFontsList() + { if (($fontsdir = opendir(TCPDF_FONTS::_getfontpath())) !== false) { while (($file = readdir($fontsdir)) !== false) { if (substr($file, -4) == '.php') { @@ -4191,7 +4287,8 @@ class TCPDF { * @since 1.5 * @see SetFont(), setFontSubsetting() */ - public function AddFont($family, $style='', $fontfile='', $subset='default') { + public function AddFont($family, $style = '', $fontfile = '', $subset = 'default') + { if ($subset === 'default') { $subset = $this->font_subsetting; } @@ -4293,7 +4390,7 @@ class TCPDF { } // include font file if (!TCPDF_STATIC::empty_string($fontfile) AND (@TCPDF_STATIC::file_exists($fontfile))) { - include($fontfile); + include $fontfile; } else { $this->Error('Could not include font definition file: '.$family.''); } @@ -4414,7 +4511,7 @@ class TCPDF { } if (!TCPDF_STATIC::empty_string($file)) { if (!isset($this->FontFiles[$file])) { - if ((strcasecmp($type,'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) { + if ((strcasecmp($type, 'TrueType') == 0) OR (strcasecmp($type, 'TrueTypeUnicode') == 0)) { $this->FontFiles[$file] = array('length1' => $originalsize, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey)); } elseif ($type != 'core') { $this->FontFiles[$file] = array('length1' => $size1, 'length2' => $size2, 'fontdir' => $fontdir, 'subset' => $subset, 'fontkeys' => array($fontkey)); @@ -4447,7 +4544,8 @@ class TCPDF { * @since 1.0 * @see AddFont(), SetFontSize() */ - public function SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true) { + public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true) + { //Select a font; size given in points if ($size === null) { $size = $this->FontSizePt; @@ -4475,8 +4573,9 @@ class TCPDF { * @since 1.0 * @see SetFont() */ - public function SetFontSize($size, $out=true) { - $size = (float)$size; + public function SetFontSize($size, $out = true) + { + $size = (float) $size; // font size in points $this->FontSizePt = $size; // font size in user units @@ -4516,7 +4615,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getFontBBox() { + public function getFontBBox() + { $fbbox = array(); if (isset($this->CurrentFont['desc']['FontBBox'])) { $tmpbbox = explode(' ', substr($this->CurrentFont['desc']['FontBBox'], 1, -1)); @@ -4555,7 +4655,8 @@ class TCPDF { * @return float Absolute measure. * @since 5.9.186 (2012-09-13) */ - public function getAbsFontMeasure($s) { + public function getAbsFontMeasure($s) + { return ($s * $this->FontSize / 1000); } @@ -4565,7 +4666,8 @@ class TCPDF { * @return mixed array(xMin, yMin, xMax, yMax) or FALSE if not defined. * @since 5.9.186 (2012-09-13) */ - public function getCharBBox($char) { + public function getCharBBox($char) + { $c = intval($char); if (isset($this->CurrentFont['cw'][$c])) { // glyph is defined ... use zero width & height for glyphs without outlines @@ -4588,7 +4690,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.9.003 (2010-03-30) */ - public function getFontDescent($font, $style='', $size=0) { + public function getFontDescent($font, $style = '', $size = 0) + { $fontdata = $this->AddFont($font, $style); $fontinfo = $this->getFontBuffer($fontdata['fontkey']); if (isset($fontinfo['desc']['Descent']) AND ($fontinfo['desc']['Descent'] <= 0)) { @@ -4609,7 +4712,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.9.003 (2010-03-30) */ - public function getFontAscent($font, $style='', $size=0) { + public function getFontAscent($font, $style = '', $size = 0) + { $fontdata = $this->AddFont($font, $style); $fontinfo = $this->getFontBuffer($fontdata['fontkey']); if (isset($fontinfo['desc']['Ascent']) AND ($fontinfo['desc']['Ascent'] > 0)) { @@ -4629,7 +4733,8 @@ class TCPDF { * @public * @since 5.9.153 (2012-03-28) */ - public function isCharDefined($char, $font='', $style='') { + public function isCharDefined($char, $font = '', $style = '') + { if (is_string($char)) { // get character code $char = TCPDF_FONTS::UTF8StringToArray($char, $this->isunicode, $this->CurrentFont); @@ -4656,7 +4761,8 @@ class TCPDF { * @public * @since 5.9.153 (2012-03-28) */ - public function replaceMissingChars($text, $font='', $style='', $subs=array()) { + public function replaceMissingChars($text, $font = '', $style = '', $subs = array()) + { if (empty($subs)) { return $text; } @@ -4672,7 +4778,7 @@ class TCPDF { if (isset($subs[$chr])) { // we have available substitutions if (is_array($subs[$chr])) { - foreach($subs[$chr] as $s) { + foreach ($subs[$chr] as $s) { if (isset($fontinfo['cw'][$s])) { $uniarr[$k] = $s; break; @@ -4693,7 +4799,8 @@ class TCPDF { * @public * @since 4.5.025 */ - public function SetDefaultMonospacedFont($font) { + public function SetDefaultMonospacedFont($font) + { $this->default_monospaced_font = $font; } @@ -4704,7 +4811,8 @@ class TCPDF { * @since 1.5 * @see Cell(), Write(), Image(), Link(), SetLink() */ - public function AddLink() { + public function AddLink() + { // create a new internal link $n = count($this->links) + 1; $this->links[$n] = array('p' => 0, 'y' => 0, 'f' => false); @@ -4720,7 +4828,8 @@ class TCPDF { * @since 1.5 * @see AddLink() */ - public function SetLink($link, $y=0, $page=-1) { + public function SetLink($link, $y = 0, $page = -1) + { $fixed = false; if (!empty($page) AND ($page[0] == '*')) { $page = intval(substr($page, 1)); @@ -4749,7 +4858,8 @@ class TCPDF { * @since 1.5 * @see AddLink(), Annotation(), Cell(), Write(), Image() */ - public function Link($x, $y, $w, $h, $link, $spaces=0) { + public function Link($x, $y, $w, $h, $link, $spaces = 0) + { $this->Annotation($x, $y, $w, $h, $link, array('Subtype'=>'Link'), $spaces); } @@ -4766,7 +4876,8 @@ class TCPDF { * @public * @since 4.0.018 (2008-08-06) */ - public function Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), $spaces=0) { + public function Annotation($x, $y, $w, $h, $text, $opt = array('Subtype'=>'Text'), $spaces = 0) + { if ($this->inxobj) { // store parameters for later use on template $this->xobjects[$this->xobjid]['annotations'][] = array('x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'text' => $text, 'opt' => $opt, 'spaces' => $spaces); @@ -4856,15 +4967,16 @@ class TCPDF { * @protected * @see Annotation() */ - protected function _putEmbeddedFiles() { - if ($this->pdfa_mode && $this->pdfa_version != 3) { + protected function _putEmbeddedFiles() + { + if ($this->pdfa_mode && $this->pdfa_version != 3) { // embedded files are not allowed in PDF/A mode version 1 and 2 return; } reset($this->embeddedfiles); foreach ($this->embeddedfiles as $filename => $filedata) { $data = TCPDF_STATIC::fileGetContents($filedata['file']); - if ($data !== FALSE) { + if ($data !== false) { $rawsize = strlen($data); if ($rawsize > 0) { // update name tree @@ -4922,7 +5034,8 @@ class TCPDF { * @since 1.0 * @see Cell(), Write(), MultiCell(), WriteHTML(), WriteHTMLCell() */ - public function Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false) { + public function Text($x, $y, $txt, $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false) + { $textrendermode = $this->textrendermode; $textstrokewidth = $this->textstrokewidth; $this->setTextRenderingMode($fstroke, $ffill, $fclip); @@ -4942,7 +5055,8 @@ class TCPDF { * @since 1.4 * @see SetAutoPageBreak() */ - public function AcceptPageBreak() { + public function AcceptPageBreak() + { if ($this->num_columns > 1) { // multi column mode if ($this->current_column < ($this->num_columns - 1)) { @@ -4969,7 +5083,8 @@ class TCPDF { * @since 3.2.000 (2008-07-01) * @protected */ - protected function checkPageBreak($h=0, $y='', $addpage=true) { + protected function checkPageBreak($h = 0, $y = '', $addpage = true) + { if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; } @@ -5023,7 +5138,8 @@ class TCPDF { * @since 1.0 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() */ - public function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') { + public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M') + { $prev_cell_margin = $this->cell_margin; $prev_cell_padding = $this->cell_padding; $this->adjustCellPadding($border); @@ -5092,7 +5208,8 @@ class TCPDF { * @since 1.0 * @see Cell() */ - protected function getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') { + protected function getCellCode($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M') + { // replace 'NO-BREAK SPACE' (U+00A0) character with a simple space $txt = str_replace(TCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt); $prev_cell_margin = $this->cell_margin; @@ -5560,7 +5677,8 @@ class TCPDF { * @protected * @since 5.9.167 (2012-06-22) */ - protected function replaceChar($oldchar, $newchar) { + protected function replaceChar($oldchar, $newchar) + { if ($this->isCharDefined($newchar)) { // add the new char on the subset list $this->CurrentFont['subsetchars'][$newchar] = true; @@ -5583,7 +5701,8 @@ class TCPDF { * @see SetLineStyle() * @since 5.7.000 (2010-08-02) */ - protected function getCellBorder($x, $y, $w, $h, $brd) { + protected function getCellBorder($x, $y, $w, $h, $brd) + { $s = ''; // string to be returned if (empty($brd)) { return $s; @@ -5673,25 +5792,25 @@ class TCPDF { if (strlen($border) == 4) { $s .= sprintf('%F %F %F %F re S ', $xT, $yT, ($w * $k), (-$h * $k)); } elseif (strlen($border) == 3) { - if (strpos($border,'B') === false) { // LTR + if (strpos($border, 'B') === false) { // LTR $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif (strpos($border,'L') === false) { // TRB + } elseif (strpos($border, 'L') === false) { // TRB $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; - } elseif (strpos($border,'T') === false) { // RBL + } elseif (strpos($border, 'T') === false) { // RBL $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif (strpos($border,'R') === false) { // BLT + } elseif (strpos($border, 'R') === false) { // BLT $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); @@ -5699,34 +5818,34 @@ class TCPDF { $s .= 'S '; } } elseif (strlen($border) == 2) { - if ((strpos($border,'L') !== false) AND (strpos($border,'T') !== false)) { // LT + if ((strpos($border, 'L') !== false) AND (strpos($border, 'T') !== false)) { // LT $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - } elseif ((strpos($border,'T') !== false) AND (strpos($border,'R') !== false)) { // TR + } elseif ((strpos($border, 'T') !== false) AND (strpos($border, 'R') !== false)) { // TR $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif ((strpos($border,'R') !== false) AND (strpos($border,'B') !== false)) { // RB + } elseif ((strpos($border, 'R') !== false) AND (strpos($border, 'B') !== false)) { // RB $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; - } elseif ((strpos($border,'B') !== false) AND (strpos($border,'L') !== false)) { // BL + } elseif ((strpos($border, 'B') !== false) AND (strpos($border, 'L') !== false)) { // BL $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif ((strpos($border,'L') !== false) AND (strpos($border,'R') !== false)) { // LR + } elseif ((strpos($border, 'L') !== false) AND (strpos($border, 'R') !== false)) { // LR $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif ((strpos($border,'T') !== false) AND (strpos($border,'B') !== false)) { // TB + } elseif ((strpos($border, 'T') !== false) AND (strpos($border, 'B') !== false)) { // TB $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; @@ -5735,19 +5854,19 @@ class TCPDF { $s .= 'S '; } } else { // strlen($border) == 1 - if (strpos($border,'L') !== false) { // L + if (strpos($border, 'L') !== false) { // L $s .= sprintf('%F %F m ', $xL, $yL); $s .= sprintf('%F %F l ', $xT, $yT); $s .= 'S '; - } elseif (strpos($border,'T') !== false) { // T + } elseif (strpos($border, 'T') !== false) { // T $s .= sprintf('%F %F m ', $xT, $yT); $s .= sprintf('%F %F l ', $xR, $yR); $s .= 'S '; - } elseif (strpos($border,'R') !== false) { // R + } elseif (strpos($border, 'R') !== false) { // R $s .= sprintf('%F %F m ', $xR, $yR); $s .= sprintf('%F %F l ', $xB, $yB); $s .= 'S '; - } elseif (strpos($border,'B') !== false) { // B + } elseif (strpos($border, 'B') !== false) { // B $s .= sprintf('%F %F m ', $xB, $yB); $s .= sprintf('%F %F l ', $xL, $yL); $s .= 'S '; @@ -5786,7 +5905,8 @@ class TCPDF { * @since 1.3 * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() */ - public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { + public function MultiCell($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $ln = 1, $x = '', $y = '', $reseth = true, $stretch = 0, $ishtml = false, $autopadding = true, $maxh = 0, $valign = 'T', $fitcell = false) + { $prev_cell_margin = $this->cell_margin; $prev_cell_padding = $this->cell_padding; // adjust internal padding @@ -6154,8 +6274,9 @@ class TCPDF { * @public * @since 4.5.011 */ - public function getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { - if ($txt === NULL) { + public function getNumLines($txt, $w = 0, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0) + { + if ($txt === null) { return 0; } if ($txt === '') { @@ -6273,7 +6394,8 @@ class TCPDF { * @author Nicola Asuni, Alexander Escalona Fern\E1ndez * @public */ - public function getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding='', $border=0) { + public function getStringHeight($w, $txt, $reseth = false, $autopadding = true, $cellpadding = '', $border = 0) + { // adjust internal padding $prev_cell_padding = $this->cell_padding; $prev_lasth = $this->lasth; @@ -6306,7 +6428,8 @@ class TCPDF { * @public * @since 1.5 */ - public function Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin='') { + public function Write($h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0, $wadj = 0, $margin = '') + { // check page for no-write regions and adapt page margins if necessary list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y); if (strlen($txt) == 0) { @@ -6737,7 +6860,8 @@ class TCPDF { * @return int Return the remaining width * @protected */ - protected function getRemainingWidth() { + protected function getRemainingWidth() + { list($this->x, $this->y) = $this->checkPageRegions(0, $this->x, $this->y); if ($this->rtl) { return ($this->x - $this->lMargin); @@ -6757,7 +6881,8 @@ class TCPDF { * @protected * @since 5.5.009 (2010-07-05) */ - protected function fitBlock($w, $h, $x, $y, $fitonpage=false) { + protected function fitBlock($w, $h, $x, $y, $fitonpage = false) + { if ($w <= 0) { // set maximum width $w = ($this->w - $this->lMargin - $this->rMargin); @@ -6852,7 +6977,8 @@ class TCPDF { * @public * @since 1.1 */ - public function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()) { + public function Image($file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array()) + { if ($this->state != 2) { return; } @@ -6865,7 +6991,7 @@ class TCPDF { // check page for no-write regions and adapt page margins if necessary list($x, $y) = $this->checkPageRegions($h, $x, $y); $exurl = ''; // external streams - $imsize = FALSE; + $imsize = false; // check if we are passing an image as file or string if ($file[0] === '@') { // image from string @@ -6881,13 +7007,18 @@ class TCPDF { // DOL CHANGE If we keep this, the image is not visible on pages after the first one. //var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file))); //return false; + // try to encode spaces on filename + $tfile = str_replace(' ', '%20', $file); + if (@TCPDF_STATIC::file_exists($tfile)) { + $file = $tfile; + } } - if (($imsize = @getimagesize($file)) === FALSE) { + if (($imsize = @getimagesize($file)) === false) { if (in_array($file, $this->imagekeys)) { // get existing image data $info = $this->getImageBuffer($file); $imsize = array($info['w'], $info['h']); - } elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) { + } elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === false) { $imgdata = TCPDF_STATIC::fileGetContents($file); } } @@ -6904,12 +7035,12 @@ class TCPDF { fclose($fp); unset($imgdata); $imsize = @getimagesize($file); - if ($imsize === FALSE) { + if ($imsize === false) { unlink($file); $file = $original_file; } } - if ($imsize === FALSE) { + if ($imsize === false) { if (($w > 0) AND ($h > 0)) { // get measures from specified data $pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k; @@ -7010,14 +7141,14 @@ class TCPDF { $newimage = false; // get existing image data $info = $this->getImageBuffer($file); - if (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE) { + if (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false) { // check if the newer image is larger $oldsize = ($info['w'] * $info['h']); if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) { $newimage = true; } } - } elseif (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE)) { + } elseif (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false)) { // create temp image file (without alpha channel) $tempfile_plain = K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_imgmask_plain_'.$filehash; // create temp alpha file @@ -7057,7 +7188,7 @@ class TCPDF { if ((method_exists('TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded('imagick'))))) { // TCPDF image functions $info = TCPDF_IMAGES::$mtd($file); - if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === FALSE) + if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_'.$this->file_id.'_imgmask_') === false) AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) { return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash); } @@ -7081,7 +7212,7 @@ class TCPDF { $info = TCPDF_IMAGES::_toJPEG($img, $this->jpeg_quality, TCPDF_STATIC::getObjFilename('img', $this->file_id)); } } - } catch(Exception $e) { + } catch (Exception $e) { $info = false; } } @@ -7097,7 +7228,7 @@ class TCPDF { // get SVG file content $svgimg = TCPDF_STATIC::fileGetContents($file); } - if ($svgimg !== FALSE) { + if ($svgimg !== false) { // get width and height $regs = array(); if (preg_match('/]*)>/si', $svgimg, $regs)) { @@ -7142,7 +7273,7 @@ class TCPDF { $info = TCPDF_IMAGES::_parsejpeg($tempname); unlink($tempname); $img->destroy(); - } catch(Exception $e) { + } catch (Exception $e) { $info = false; } } @@ -7217,7 +7348,7 @@ class TCPDF { $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T': { $this->y = $y; $this->x = $this->img_rb_x; @@ -7270,7 +7401,8 @@ class TCPDF { * @since 4.3.007 (2008-12-04) * @see Image() */ - protected function ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash='') { + protected function ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash = '') + { // create temp images if (empty($filehash)) { $filehash = md5($file); @@ -7364,7 +7496,8 @@ class TCPDF { * @protected * @since 4.3.007 (2008-12-04) */ - protected function getGDgamma($img, $c) { + protected function getGDgamma($img, $c) + { if (!isset($this->gdgammacache['#'.$c])) { $colors = imagecolorsforindex($img, $c); // GD alpha is only 7 bit (0 -> 127) @@ -7389,7 +7522,8 @@ class TCPDF { * @since 1.0 * @see Cell() */ - public function Ln($h='', $cell=false) { + public function Ln($h = '', $cell = false) + { if (($this->num_columns > 1) AND ($this->y == $this->columns[$this->current_column]['y']) AND isset($this->columns[$this->current_column]['x']) AND ($this->x == $this->columns[$this->current_column]['x'])) { // revove vertical space from the top of the column return; @@ -7423,7 +7557,8 @@ class TCPDF { * @since 1.2 * @see SetX(), GetY(), SetY() */ - public function GetX() { + public function GetX() + { //Get x position if ($this->rtl) { return ($this->w - $this->x); @@ -7439,7 +7574,8 @@ class TCPDF { * @since 1.2 * @see SetX(), GetY(), SetY() */ - public function GetAbsX() { + public function GetAbsX() + { return $this->x; } @@ -7450,7 +7586,8 @@ class TCPDF { * @since 1.0 * @see SetY(), GetX(), SetX() */ - public function GetY() { + public function GetY() + { return $this->y; } @@ -7463,7 +7600,8 @@ class TCPDF { * @since 1.2 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetX($x, $rtloff=false) { + public function SetX($x, $rtloff = false) + { $x = floatval($x); if (!$rtloff AND $this->rtl) { if ($x >= 0) { @@ -7496,7 +7634,8 @@ class TCPDF { * @since 1.0 * @see GetX(), GetY(), SetY(), SetXY() */ - public function SetY($y, $resetx=true, $rtloff=false) { + public function SetY($y, $resetx = true, $rtloff = false) + { $y = floatval($y); if ($resetx) { //reset x @@ -7529,7 +7668,8 @@ class TCPDF { * @since 1.2 * @see SetX(), SetY() */ - public function SetXY($x, $y, $rtloff=false) { + public function SetXY($x, $y, $rtloff = false) + { $this->SetY($y, false, $rtloff); $this->SetX($x, $rtloff); } @@ -7541,7 +7681,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsX($x) { + public function SetAbsX($x) + { $this->x = floatval($x); } @@ -7552,7 +7693,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsY($y) { + public function SetAbsY($y) + { $this->y = floatval($y); } @@ -7564,7 +7706,8 @@ class TCPDF { * @since 5.9.186 (2012-09-13) * @see setAbsX(), setAbsY(), SetAbsXY() */ - public function SetAbsXY($x, $y) { + public function SetAbsXY($x, $y) + { $this->SetAbsX($x); $this->SetAbsY($y); } @@ -7580,7 +7723,8 @@ class TCPDF { * @since 1.0 * @see Close() */ - public function Output($name='doc.pdf', $dest='I') { + public function Output($name = 'doc.pdf', $dest = 'I') + { //Output PDF to some destination //Finish document if necessary if ($this->state < 3) { @@ -7648,7 +7792,7 @@ class TCPDF { $this->buffer = substr($pdfdoc, 0, $byte_range[1]).'<'.$signature.'>'.substr($pdfdoc, $byte_range[1]); $this->bufferlen = strlen($this->buffer); } - switch($dest) { + switch ($dest) { case 'I': { // Send PDF to the standard output if (ob_get_contents()) { @@ -7779,7 +7923,8 @@ class TCPDF { * @public * @since 4.5.016 (2009-02-24) */ - public function _destroy($destroyall=false, $preserve_objcopy=false) { + public function _destroy($destroyall = false, $preserve_objcopy = false) + { // restore internal encoding if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { mb_internal_encoding($this->internal_encoding); @@ -7791,7 +7936,7 @@ class TCPDF { self::$cleaned_ids[$this->file_id] = true; // remove all temporary files if ($handle = opendir(K_PATH_CACHE)) { - while ( false !== ( $file_name = readdir( $handle ) ) ) { + while ( false !== ( $file_name = readdir($handle) ) ) { if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) { unlink(K_PATH_CACHE.$file_name); } @@ -7799,9 +7944,9 @@ class TCPDF { closedir($handle); } if (isset($this->imagekeys)) { - foreach($this->imagekeys as $file) { -// @CHANGE DOL -// unlink($file); + foreach ($this->imagekeys as $file) { + // @CHANGE DOL + // unlink($file); } } } @@ -7812,8 +7957,8 @@ class TCPDF { 'bufferlen', 'buffer', 'cached_files', -// @CHANGE DOL -// 'imagekeys', + // @CHANGE DOL + // 'imagekeys', 'sign', 'signature_data', 'signature_max_length', @@ -7834,7 +7979,8 @@ class TCPDF { * Check for locale-related bug * @protected */ - protected function _dochecks() { + protected function _dochecks() + { //Check for locale-related bug if (1.1 == 1) { $this->Error('Don\'t alter the locale before including class file'); @@ -7851,7 +7997,8 @@ class TCPDF { * @return array of page number aliases * @protected */ - protected function getInternalPageNumberAliases($a= '') { + protected function getInternalPageNumberAliases($a = '') + { $alias = array(); // build array of Unicode + ASCII variants (the order is important) $alias = array('u' => array(), 'a' => array()); @@ -7872,10 +8019,11 @@ class TCPDF { * @return array of page number aliases * @protected */ - protected function getAllInternalPageNumberAliases() { + protected function getAllInternalPageNumberAliases() + { $basic_alias = array(TCPDF_STATIC::$alias_tot_pages, TCPDF_STATIC::$alias_num_page, TCPDF_STATIC::$alias_group_tot_pages, TCPDF_STATIC::$alias_group_num_page, TCPDF_STATIC::$alias_right_shift); $pnalias = array(); - foreach($basic_alias as $k => $a) { + foreach ($basic_alias as $k => $a) { $pnalias[$k] = $this->getInternalPageNumberAliases($a); } return $pnalias; @@ -7890,7 +8038,8 @@ class TCPDF { * @return replaced page content. * @protected */ - protected function replaceRightShiftPageNumAliases($page, $aliases, $diff) { + protected function replaceRightShiftPageNumAliases($page, $aliases, $diff) + { foreach ($aliases as $type => $alias) { foreach ($alias as $a) { // find position of compensation factor @@ -7925,7 +8074,8 @@ class TCPDF { * @param $boxes (array) Array of page boxes to set on document: ('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'). * @protected */ - protected function setPageBoxTypes($boxes) { + protected function setPageBoxTypes($boxes) + { $this->page_boxes = array(); foreach ($boxes as $box) { if (in_array($box, TCPDF_STATIC::$pageboxes)) { @@ -7938,7 +8088,8 @@ class TCPDF { * Output pages (and replace page number aliases). * @protected */ - protected function _putpages() { + protected function _putpages() + { $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; // get internal aliases for page numbers $pnalias = $this->getAllInternalPageNumberAliases(); @@ -8084,7 +8235,7 @@ class TCPDF { //Pages root $out = $this->_getobj(1)."\n"; $out .= '<< /Type /Pages /Kids ['; - foreach($this->page_obj_id as $page_obj) { + foreach ($this->page_obj_id as $page_obj) { $out .= ' '.$page_obj.' 0 R'; } $out .= ' ] /Count '.$num_pages.' >>'; @@ -8100,7 +8251,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.0.010 (2010-05-17) */ - protected function _getannotsrefs($n) { + protected function _getannotsrefs($n) + { if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) { return ''; } @@ -8144,7 +8296,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.0.018 (2008-08-06) */ - protected function _putannotsobjs() { + protected function _putannotsobjs() + { // reset object counter for ($n=1; $n <= $this->numpages; ++$n) { if (isset($this->PageAnnots[$n])) { @@ -8664,7 +8817,7 @@ class TCPDF { if (is_array($pl['opt']['ff'])) { // array of bit settings $flag = 0; - foreach($pl['opt']['ff'] as $val) { + foreach ($pl['opt']['ff'] as $val) { $flag += 1 << ($val - 1); } } else { @@ -8728,7 +8881,7 @@ class TCPDF { } if (isset($pl['opt']['opt']) AND (is_array($pl['opt']['opt'])) AND !empty($pl['opt']['opt'])) { $annots .= ' /Opt ['; - foreach($pl['opt']['opt'] AS $copt) { + foreach ($pl['opt']['opt'] AS $copt) { if (is_array($copt)) { $annots .= ' ['.$this->_textstring($copt[0], $annot_obj_id).' '.$this->_textstring($copt[1], $annot_obj_id).']'; } else { @@ -8742,7 +8895,7 @@ class TCPDF { } if (isset($pl['opt']['i']) AND (is_array($pl['opt']['i'])) AND !empty($pl['opt']['i'])) { $annots .= ' /I ['; - foreach($pl['opt']['i'] AS $copt) { + foreach ($pl['opt']['i'] AS $copt) { $annots .= intval($copt).' '; } $annots .= ']'; @@ -8789,7 +8942,8 @@ class TCPDF { * @protected * @since 4.8.001 (2009-09-09) */ - protected function _putAPXObject($w=0, $h=0, $stream='') { + protected function _putAPXObject($w = 0, $h = 0, $stream = '') + { $stream = trim($stream); $out = $this->_getobj()."\n"; $this->xobjects['AX'.$this->n] = array('n' => $this->n); @@ -8819,7 +8973,8 @@ class TCPDF { * @author Nicola Asuni * @protected */ - protected function _putfonts() { + protected function _putfonts() + { $nf = $this->n; foreach ($this->diffs as $diff) { //Encodings @@ -8971,7 +9126,8 @@ class TCPDF { * @author Nicola Asuni * @since 1.52.0.TC005 (2005-01-05) */ - protected function _puttruetypeunicode($font) { + protected function _puttruetypeunicode($font) + { $fontname = ''; if ($font['subset']) { // change name for font subsetting @@ -9075,7 +9231,8 @@ class TCPDF { * @author Andrew Whitehead, Nicola Asuni, Yukihiro Nakadaira * @since 3.2.000 (2008-06-23) */ - protected function _putcidfont0($font) { + protected function _putcidfont0($font) + { $cidoffset = 0; if (!isset($font['cw'][1])) { $cidoffset = 31; @@ -9145,7 +9302,8 @@ class TCPDF { * Output images. * @protected */ - protected function _putimages() { + protected function _putimages() + { $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; foreach ($this->imagekeys as $file) { $info = $this->getImageBuffer($file); @@ -9274,7 +9432,8 @@ class TCPDF { * @protected * @see startTemplate(), endTemplate(), printTemplate() */ - protected function _putxobjects() { + protected function _putxobjects() + { foreach ($this->xobjects as $key => $data) { if (isset($data['outdata'])) { $stream = str_replace($this->epsmarker, '', trim($data['outdata'])); @@ -9377,7 +9536,8 @@ class TCPDF { * @protected * @since 4.0.024 (2008-09-12) */ - protected function _putspotcolors() { + protected function _putspotcolors() + { foreach ($this->spot_colors as $name => $color) { $this->_newobj(); $this->spot_colors[$name]['n'] = $this->n; @@ -9397,7 +9557,8 @@ class TCPDF { * @protected * @since 5.8.014 (2010-08-23) */ - protected function _getxobjectdict() { + protected function _getxobjectdict() + { $out = ''; foreach ($this->xobjects as $id => $objid) { $out .= ' /'.$id.' '.$objid['n'].' 0 R'; @@ -9409,7 +9570,8 @@ class TCPDF { * Output Resources Dictionary. * @protected */ - protected function _putresourcedict() { + protected function _putresourcedict() + { $out = $this->_getobj(2)."\n"; $out .= '<< /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'; $out .= ' /Font <<'; @@ -9473,7 +9635,8 @@ class TCPDF { * Output Resources. * @protected */ - protected function _putresources() { + protected function _putresources() + { $this->_putextgstates(); $this->_putocg(); $this->_putfonts(); @@ -9496,7 +9659,8 @@ class TCPDF { * @return int object id * @protected */ - protected function _putinfo() { + protected function _putinfo() + { $oid = $this->_newobj(); $out = '<<'; // store current isunicode value @@ -9547,7 +9711,8 @@ class TCPDF { * @since 5.9.128 (2011-10-06) * @public */ - public function setExtraXMP($xmp) { + public function setExtraXMP($xmp) + { $this->custom_xmp = $xmp; } @@ -9558,7 +9723,8 @@ class TCPDF { * @since 6.3.0 (2019-09-19) * @public */ - public function setExtraXMPRDF($xmp) { + public function setExtraXMPRDF($xmp) + { $this->custom_xmp_rdf = $xmp; } @@ -9568,7 +9734,8 @@ class TCPDF { * @since 5.9.121 (2011-09-28) * @protected */ - protected function _putXMP() { + protected function _putXMP() + { $oid = $this->_newobj(); // store current isunicode value $prev_isunicode = $this->isunicode; @@ -9707,7 +9874,8 @@ class TCPDF { * @return int object id * @protected */ - protected function _putcatalog() { + protected function _putcatalog() + { // put XMP $xmpobj = $this->_putXMP(); // if required, add standard sRGB ICC colour profile @@ -9837,7 +10005,7 @@ class TCPDF { } } if (!empty($this->form_obj_id)) { - foreach($this->form_obj_id as $objid) { + foreach ($this->form_obj_id as $objid) { $objrefs .= ' '.$objid.' 0 R'; } } @@ -9894,7 +10062,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - protected function _putviewerpreferences() { + protected function _putviewerpreferences() + { $vp = $this->viewer_preferences; $out = ' /ViewerPreferences <<'; if ($this->rtl) { @@ -9953,7 +10122,7 @@ class TCPDF { foreach ($vp['PrintPageRange'] as $k => $v) { $PrintPageRangeNum .= ' '.($v - 1).''; } - $out .= ' /PrintPageRange ['.substr($PrintPageRangeNum,1).']'; + $out .= ' /PrintPageRange ['.substr($PrintPageRangeNum, 1).']'; } if (isset($vp['NumCopies'])) { $out .= ' /NumCopies '.intval($vp['NumCopies']); @@ -9966,7 +10135,8 @@ class TCPDF { * Output PDF File Header (7.5.2). * @protected */ - protected function _putheader() { + protected function _putheader() + { $this->_out('%PDF-'.$this->PDFVersion); $this->_out('%'.chr(0xe2).chr(0xe3).chr(0xcf).chr(0xd3)); } @@ -9975,7 +10145,8 @@ class TCPDF { * Output end of document (EOF). * @protected */ - protected function _enddoc() { + protected function _enddoc() + { if (isset($this->CurrentFont['fontkey']) AND isset($this->CurrentFont['subsetchars'])) { // save subset chars of the previous font $this->setFontSubBuffer($this->CurrentFont['fontkey'], 'subsetchars', $this->CurrentFont['subsetchars']); @@ -10066,7 +10237,8 @@ class TCPDF { * @protected * @see getPageSizeFromFormat(), setPageFormat() */ - protected function _beginpage($orientation='', $format='') { + protected function _beginpage($orientation = '', $format = '') + { ++$this->page; $this->pageobjects[$this->page] = array(); $this->setPageBuffer($this->page, ''); @@ -10109,7 +10281,8 @@ class TCPDF { * Mark end of page. * @protected */ - protected function _endpage() { + protected function _endpage() + { $this->setVisibility('all'); $this->state = 1; } @@ -10119,7 +10292,8 @@ class TCPDF { * @return int object number * @protected */ - protected function _newobj() { + protected function _newobj() + { $this->_out($this->_getobj()); return $this->n; } @@ -10131,7 +10305,8 @@ class TCPDF { * @protected * @since 5.8.009 (2010-08-20) */ - protected function _getobj($objid='') { + protected function _getobj($objid = '') + { if ($objid === '') { ++$this->n; $objid = $this->n; @@ -10148,7 +10323,8 @@ class TCPDF { * @param $txt (string) text to underline * @protected */ - protected function _dounderline($x, $y, $txt) { + protected function _dounderline($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dounderlinew($x, $y, $w); } @@ -10161,7 +10337,8 @@ class TCPDF { * @protected * @since 4.8.008 (2009-09-29) */ - protected function _dounderlinew($x, $y, $w) { + protected function _dounderlinew($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew), $w * $this->k, $linew); } @@ -10173,7 +10350,8 @@ class TCPDF { * @param $txt (string) text to linethrough * @protected */ - protected function _dolinethrough($x, $y, $txt) { + protected function _dolinethrough($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dolinethroughw($x, $y, $w); } @@ -10186,7 +10364,8 @@ class TCPDF { * @protected * @since 4.9.008 (2009-09-29) */ - protected function _dolinethroughw($x, $y, $w) { + protected function _dolinethroughw($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew + ($this->FontSizePt / 3)), $w * $this->k, $linew); } @@ -10199,7 +10378,8 @@ class TCPDF { * @protected * @since 4.9.015 (2010-04-19) */ - protected function _dooverline($x, $y, $txt) { + protected function _dooverline($x, $y, $txt) + { $w = $this->GetStringWidth($txt); return $this->_dooverlinew($x, $y, $w); } @@ -10212,10 +10392,10 @@ class TCPDF { * @protected * @since 4.9.015 (2010-04-19) */ - protected function _dooverlinew($x, $y, $w) { + protected function _dooverlinew($x, $y, $w) + { $linew = - $this->CurrentFont['ut'] / 1000 * $this->FontSizePt; return sprintf('%F %F %F %F re f', $x * $this->k, (($this->h - $y + $this->FontAscent) * $this->k) - $linew, $w * $this->k, $linew); - } /** @@ -10225,7 +10405,8 @@ class TCPDF { * @return string escaped string. * @protected */ - protected function _datastring($s, $n=0) { + protected function _datastring($s, $n = 0) + { if ($n == 0) { $n = $this->n; } @@ -10239,7 +10420,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setDocCreationTimestamp($time) { + public function setDocCreationTimestamp($time) + { if (is_string($time)) { $time = TCPDF_STATIC::getTimestamp($time); } @@ -10252,7 +10434,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setDocModificationTimestamp($time) { + public function setDocModificationTimestamp($time) + { if (is_string($time)) { $time = TCPDF_STATIC::getTimestamp($time); } @@ -10265,7 +10448,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getDocCreationTimestamp() { + public function getDocCreationTimestamp() + { return $this->doc_creation_timestamp; } @@ -10275,7 +10459,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getDocModificationTimestamp() { + public function getDocModificationTimestamp() + { return $this->doc_modification_timestamp; } @@ -10287,7 +10472,8 @@ class TCPDF { * @protected * @since 4.6.028 (2009-08-25) */ - protected function _datestring($n=0, $timestamp=0) { + protected function _datestring($n = 0, $timestamp = 0) + { if ((empty($timestamp)) OR ($timestamp < 0)) { $timestamp = $this->doc_creation_timestamp; } @@ -10301,7 +10487,8 @@ class TCPDF { * @return string escaped string. * @protected */ - protected function _textstring($s, $n=0) { + protected function _textstring($s, $n = 0) + { if ($this->isunicode) { //Convert string to UTF-16BE $s = TCPDF_FONTS::UTF8ToUTF16BE($s, true, $this->isunicode, $this->CurrentFont); @@ -10317,7 +10504,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.5.000 (2010-06-22) */ - protected function _getrawstream($s, $n=0) { + protected function _getrawstream($s, $n = 0) + { if ($n <= 0) { // default to current object $n = $this->n; @@ -10330,7 +10518,8 @@ class TCPDF { * @param $s (string) string to output. * @protected */ - protected function _out($s) { + protected function _out($s) + { if ($this->state == 2) { if ($this->inxobj) { // we are inside an XObject template @@ -10359,7 +10548,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setHeaderFont($font) { + public function setHeaderFont($font) + { $this->header_font = $font; } @@ -10369,7 +10559,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getHeaderFont() { + public function getHeaderFont() + { return $this->header_font; } @@ -10379,7 +10570,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setFooterFont($font) { + public function setFooterFont($font) + { $this->footer_font = $font; } @@ -10389,7 +10581,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getFooterFont() { + public function getFooterFont() + { return $this->footer_font; } @@ -10399,7 +10592,8 @@ class TCPDF { * @public * @since 1.1 */ - public function setLanguageArray($language) { + public function setLanguageArray($language) + { $this->l = $language; if (isset($this->l['a_meta_dir'])) { $this->rtl = $this->l['a_meta_dir']=='rtl' ? true : false; @@ -10412,7 +10606,8 @@ class TCPDF { * Returns the PDF data. * @public */ - public function getPDFData() { + public function getPDFData() + { if ($this->state < 3) { $this->Close(); } @@ -10431,7 +10626,8 @@ class TCPDF { * @return the number of cells used or the remaining text if $firstline = true; * @public */ - public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) { + public function addHtmlLink($url, $name, $fill = false, $firstline = false, $color = '', $style = -1, $firstblock = false) + { if (isset($url[1]) AND ($url[0] == '#') AND is_numeric($url[1])) { // convert url to internal link $lnkdata = explode(',', $url); @@ -10473,7 +10669,8 @@ class TCPDF { * @public * @see setImageScale(), getImageScale() */ - public function pixelsToUnits($px) { + public function pixelsToUnits($px) + { return ($px / ($this->imgscale * $this->k)); } @@ -10484,7 +10681,8 @@ class TCPDF { * @return string converted text string * @public */ - public function unhtmlentities($text_to_convert) { + public function unhtmlentities($text_to_convert) + { return @html_entity_decode($text_to_convert, ENT_QUOTES, $this->encoding); } @@ -10499,7 +10697,8 @@ class TCPDF { * @author Nicola Asuni * @since 2.0.000 (2008-01-02) */ - protected function _objectkey($n) { + protected function _objectkey($n) + { $objkey = $this->encryptdata['key'].pack('VXxx', $n); if ($this->encryptdata['mode'] == 2) { // AES-128 // AES padding @@ -10519,7 +10718,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.0.005 (2010-05-11) */ - protected function _encrypt_data($n, $s) { + protected function _encrypt_data($n, $s) + { if (!$this->encrypted) { return $s; } @@ -10547,7 +10747,8 @@ class TCPDF { * @author Nicola Asuni * @since 2.0.000 (2008-01-02) */ - protected function _putencryption() { + protected function _putencryption() + { if (!$this->encrypted) { return; } @@ -10667,7 +10868,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _Uvalue() { + protected function _Uvalue() + { if ($this->encryptdata['mode'] == 0) { // RC4-40 return TCPDF_STATIC::_RC4($this->encryptdata['key'], TCPDF_STATIC::$enc_padding, $this->last_enc_key, $this->last_enc_key_c); } elseif ($this->encryptdata['mode'] < 3) { // RC4-128, AES-128 @@ -10700,7 +10902,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _UEvalue() { + protected function _UEvalue() + { $hashkey = hash('sha256', $this->encryptdata['user_password'].$this->encryptdata['UKS'], true); return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']); } @@ -10712,7 +10915,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _Ovalue() { + protected function _Ovalue() + { if ($this->encryptdata['mode'] < 3) { // RC4-40, RC4-128, AES-128 $tmp = TCPDF_STATIC::_md5_16($this->encryptdata['owner_password']); if ($this->encryptdata['mode'] > 0) { @@ -10750,7 +10954,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _OEvalue() { + protected function _OEvalue() + { $hashkey = hash('sha256', $this->encryptdata['owner_password'].$this->encryptdata['OKS'].$this->encryptdata['U'], true); return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']); } @@ -10763,7 +10968,8 @@ class TCPDF { * @since 5.9.006 (2010-10-19) * @author Nicola Asuni */ - protected function _fixAES256Password($password) { + protected function _fixAES256Password($password) + { $psw = ''; // password to be returned $psw_array = TCPDF_FONTS::utf8Bidi(TCPDF_FONTS::UTF8StringToArray($password, $this->isunicode, $this->CurrentFont), $password, $this->rtl, $this->isunicode, $this->CurrentFont); foreach ($psw_array as $c) { @@ -10778,7 +10984,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - protected function _generateencryptionkey() { + protected function _generateencryptionkey() + { $keybytelen = ($this->encryptdata['Length'] / 8); if (!$this->encryptdata['pubkey']) { // standard mode if ($this->encryptdata['mode'] == 3) { // AES-256 @@ -10896,7 +11103,8 @@ class TCPDF { * @since 2.0.000 (2008-01-02) * @author Nicola Asuni */ - public function SetProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null) { + public function SetProtection($permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass = '', $owner_pass = null, $mode = 0, $pubkeys = null) + { if ($this->pdfa_mode) { // encryption is not allowed in PDF/A mode return; @@ -11002,7 +11210,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function StartTransform() { + public function StartTransform() + { if ($this->state != 2) { return; } @@ -11025,7 +11234,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function StopTransform() { + public function StopTransform() + { if ($this->state != 2) { return; } @@ -11050,7 +11260,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleX($s_x, $x='', $y='') { + public function ScaleX($s_x, $x = '', $y = '') + { $this->Scale($s_x, 100, $x, $y); } @@ -11063,7 +11274,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleY($s_y, $x='', $y='') { + public function ScaleY($s_y, $x = '', $y = '') + { $this->Scale(100, $s_y, $x, $y); } @@ -11076,7 +11288,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function ScaleXY($s, $x='', $y='') { + public function ScaleXY($s, $x = '', $y = '') + { $this->Scale($s, $s, $x, $y); } @@ -11090,7 +11303,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Scale($s_x, $s_y, $x='', $y='') { + public function Scale($s_x, $s_y, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11123,7 +11337,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorH($x='') { + public function MirrorH($x = '') + { $this->Scale(-100, 100, $x); } @@ -11134,7 +11349,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorV($y='') { + public function MirrorV($y = '') + { $this->Scale(100, -100, '', $y); } @@ -11146,7 +11362,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorP($x='',$y='') { + public function MirrorP($x = '', $y = '') + { $this->Scale(-100, -100, $x, $y); } @@ -11159,7 +11376,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function MirrorL($angle=0, $x='',$y='') { + public function MirrorL($angle = 0, $x = '', $y = '') + { $this->Scale(-100, 100, $x, $y); $this->Rotate(-2*($angle-90), $x, $y); } @@ -11171,7 +11389,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function TranslateX($t_x) { + public function TranslateX($t_x) + { $this->Translate($t_x, 0); } @@ -11182,7 +11401,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function TranslateY($t_y) { + public function TranslateY($t_y) + { $this->Translate(0, $t_y); } @@ -11194,7 +11414,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Translate($t_x, $t_y) { + public function Translate($t_x, $t_y) + { //calculate elements of transformation matrix $tm = array(); $tm[0] = 1; @@ -11216,7 +11437,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Rotate($angle, $x='', $y='') { + public function Rotate($angle, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11246,7 +11468,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewX($angle_x, $x='', $y='') { + public function SkewX($angle_x, $x = '', $y = '') + { $this->Skew($angle_x, 0, $x, $y); } @@ -11259,7 +11482,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function SkewY($angle_y, $x='', $y='') { + public function SkewY($angle_y, $x = '', $y = '') + { $this->Skew(0, $angle_y, $x, $y); } @@ -11273,7 +11497,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - public function Skew($angle_x, $angle_y, $x='', $y='') { + public function Skew($angle_x, $angle_y, $x = '', $y = '') + { if ($x === '') { $x = $this->x; } @@ -11304,7 +11529,8 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see StartTransform(), StopTransform() */ - protected function Transform($tm) { + protected function Transform($tm) + { if ($this->state != 2) { return; } @@ -11336,7 +11562,8 @@ class TCPDF { * @since 1.0 * @see Line(), Rect(), Cell(), MultiCell() */ - public function SetLineWidth($width) { + public function SetLineWidth($width) + { //Set line width $this->LineWidth = $width; $this->linestyleWidth = sprintf('%F w', ($width * $this->k)); @@ -11352,34 +11579,36 @@ class TCPDF { * @since 2.1.000 (2008-01-07) * @see Line(), SetLineWidth() */ - public function GetLineWidth() { + public function GetLineWidth() + { return $this->LineWidth; } /** * Set line style. * @param $style (array) Line style. Array with keys among the following: - *
      - *
    • width (float): Width of the line in user units.
    • - *
    • cap (string): Type of cap to put on the line. Possible values are: - * butt, round, square. The difference between "square" and "butt" is that - * "square" projects a flat end past the end of the line.
    • - *
    • join (string): Type of join. Possible values are: miter, round, - * bevel.
    • - *
    • dash (mixed): Dash pattern. Is 0 (without dash) or string with - * series of length values, which are the lengths of the on and off dashes. - * For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on, - * 1 off, 2 on, 1 off, ...
    • - *
    • phase (integer): Modifier on the dash pattern which is used to shift - * the point at which the pattern starts.
    • - *
    • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
    • - *
    + *
      + *
    • width (float): Width of the line in user units.
    • + *
    • cap (string): Type of cap to put on the line. Possible values are: + * butt, round, square. The difference between "square" and "butt" is that + * "square" projects a flat end past the end of the line.
    • + *
    • join (string): Type of join. Possible values are: miter, round, + * bevel.
    • + *
    • dash (mixed): Dash pattern. Is 0 (without dash) or string with + * series of length values, which are the lengths of the on and off dashes. + * For example: "2" represents 2 on, 2 off, 2 on, 2 off, ...; "2,1" is 2 on, + * 1 off, 2 on, 1 off, ...
    • + *
    • phase (integer): Modifier on the dash pattern which is used to shift + * the point at which the pattern starts.
    • + *
    • color (array): Draw color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName).
    • + *
    * @param $ret (boolean) if true do not send the command. * @return string the PDF command * @public * @since 2.1.000 (2008-01-08) */ - public function SetLineStyle($style, $ret=false) { + public function SetLineStyle($style, $ret = false) + { $s = ''; // string to be returned if (!is_array($style)) { return; @@ -11441,7 +11670,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outPoint($x, $y) { + protected function _outPoint($x, $y) + { if ($this->state == 2) { $this->_out(sprintf('%F %F m', ($x * $this->k), (($this->h - $y) * $this->k))); } @@ -11455,7 +11685,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outLine($x, $y) { + protected function _outLine($x, $y) + { if ($this->state == 2) { $this->_out(sprintf('%F %F l', ($x * $this->k), (($this->h - $y) * $this->k))); } @@ -11471,7 +11702,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outRect($x, $y, $w, $h, $op) { + protected function _outRect($x, $y, $w, $h, $op) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F re %s', ($x * $this->k), (($this->h - $y) * $this->k), ($w * $this->k), (-$h * $this->k), $op)); } @@ -11489,7 +11721,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outCurve($x1, $y1, $x2, $y2, $x3, $y3) { + protected function _outCurve($x1, $y1, $x2, $y2, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F %F %F c', ($x1 * $this->k), (($this->h - $y1) * $this->k), ($x2 * $this->k), (($this->h - $y2) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11505,7 +11738,8 @@ class TCPDF { * @protected * @since 4.9.019 (2010-04-26) */ - protected function _outCurveV($x2, $y2, $x3, $y3) { + protected function _outCurveV($x2, $y2, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F v', ($x2 * $this->k), (($this->h - $y2) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11521,7 +11755,8 @@ class TCPDF { * @protected * @since 2.1.000 (2008-01-08) */ - protected function _outCurveY($x1, $y1, $x3, $y3) { + protected function _outCurveY($x1, $y1, $x3, $y3) + { if ($this->state == 2) { $this->_out(sprintf('%F %F %F %F y', ($x1 * $this->k), (($this->h - $y1) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k))); } @@ -11538,7 +11773,8 @@ class TCPDF { * @since 1.0 * @see SetLineWidth(), SetDrawColor(), SetLineStyle() */ - public function Line($x1, $y1, $x2, $y2, $style=array()) { + public function Line($x1, $y1, $x2, $y2, $style = array()) + { if ($this->state != 2) { return; } @@ -11558,17 +11794,18 @@ class TCPDF { * @param $h (float) Height. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $border_style (array) Border style of rectangle. Array with keys among the following: - *
      - *
    • all: Line style of all borders. Array like for SetLineStyle().
    • - *
    • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). + *
      + *
    • all: Line style of all borders. Array like for SetLineStyle().
    • + *
    • L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, the correspondent border is not drawn. Default value: default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @public * @since 1.0 * @see SetLineStyle() */ - public function Rect($x, $y, $w, $h, $style='', $border_style=array(), $fill_color=array()) { + public function Rect($x, $y, $w, $h, $style = '', $border_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11639,7 +11876,8 @@ class TCPDF { * @see SetLineStyle() * @since 2.1.000 (2008-01-08) */ - public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style='', $line_style=array(), $fill_color=array()) { + public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style = '', $line_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11669,7 +11907,8 @@ class TCPDF { * @see SetLineStyle() * @since 3.0008 (2008-05-12) */ - public function Polycurve($x0, $y0, $segments, $style='', $line_style=array(), $fill_color=array()) { + public function Polycurve($x0, $y0, $segments, $style = '', $line_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -11709,7 +11948,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function Ellipse($x0, $y0, $rx, $ry='', $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { + public function Ellipse($x0, $y0, $rx, $ry = '', $angle = 0, $astart = 0, $afinish = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2) + { if ($this->state != 2) { return; } @@ -11750,7 +11990,8 @@ class TCPDF { * @protected * @since 4.9.019 (2010-04-26) */ - protected function _outellipticalarc($xc, $yc, $rx, $ry, $xang=0, $angs=0, $angf=360, $pie=false, $nc=2, $startpoint=true, $ccw=true, $svg=false) { + protected function _outellipticalarc($xc, $yc, $rx, $ry, $xang = 0, $angs = 0, $angf = 360, $pie = false, $nc = 2, $startpoint = true, $ccw = true, $svg = false) + { if (($rx <= 0) OR ($ry < 0)) { return; } @@ -11881,7 +12122,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function Circle($x0, $y0, $r, $angstr=0, $angend=360, $style='', $line_style=array(), $fill_color=array(), $nc=2) { + public function Circle($x0, $y0, $r, $angstr = 0, $angend = 360, $style = '', $line_style = array(), $fill_color = array(), $nc = 2) + { $this->Ellipse($x0, $y0, $r, $r, 0, $angstr, $angend, $style, $line_style, $fill_color, $nc); } @@ -11890,16 +12132,17 @@ class TCPDF { * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon. Array with keys among the following: - *
      - *
    • all: Line style of all lines. Array like for SetLineStyle().
    • - *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the line. Default value is default line style (empty array). + *
      + *
    • all: Line style of all lines. Array like for SetLineStyle().
    • + *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the line. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @since 4.8.003 (2009-09-15) * @public */ - public function PolyLine($p, $style='', $line_style=array(), $fill_color=array()) { + public function PolyLine($p, $style = '', $line_style = array(), $fill_color = array()) + { $this->Polygon($p, $style, $line_style, $fill_color, false); } @@ -11908,17 +12151,18 @@ class TCPDF { * @param $p (array) Points 0 to ($np - 1). Array with values (x0, y0, x1, y1,..., x(np-1), y(np - 1)) * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon. Array with keys among the following: - *
      - *
    • all: Line style of all lines. Array like for SetLineStyle().
    • - *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the line. Default value is default line style (empty array). + *
      + *
    • all: Line style of all lines. Array like for SetLineStyle().
    • + *
    • 0 to ($np - 1): Line style of each line. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the line. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). * @param $closed (boolean) if true the polygon is closes, otherwise will remain open * @public * @since 2.1.000 (2008-01-08) */ - public function Polygon($p, $style='', $line_style=array(), $fill_color=array(), $closed=true) { + public function Polygon($p, $style = '', $line_style = array(), $fill_color = array(), $closed = true) + { if ($this->state != 2) { return; } @@ -12000,26 +12244,27 @@ class TCPDF { * @param $draw_circle (boolean) Draw inscribed circle or not. Default value: false. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon sides. Array with keys among the following: - *
      - *
    • all: Line style of all sides. Array like for SetLineStyle().
    • - *
    • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the side. Default value is default line style (empty array). + *
      + *
    • all: Line style of all sides. Array like for SetLineStyle().
    • + *
    • 0 to ($ns - 1): Line style of each side. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the side. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: - *
      - *
    • D or empty string: Draw (default).
    • - *
    • F: Fill.
    • - *
    • DF or FD: Draw and fill.
    • - *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • - *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • - *
    + *
      + *
    • D or empty string: Draw (default).
    • + *
    • F: Fill.
    • + *
    • DF or FD: Draw and fill.
    • + *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • + *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • + *
    * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ - public function RegularPolygon($x0, $y0, $r, $ns, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array()) { + public function RegularPolygon($x0, $y0, $r, $ns, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array()) + { if (3 > $ns) { $ns = 3; } @@ -12047,27 +12292,28 @@ class TCPDF { * @param $draw_circle: (boolean) Draw inscribed circle or not. Default value is false. * @param $style (string) Style of rendering. See the getPathPaintOperator() function for more information. * @param $line_style (array) Line style of polygon sides. Array with keys among the following: - *
      - *
    • all: Line style of all sides. Array like for - * SetLineStyle().
    • - *
    • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
    • - *
    - * If a key is not present or is null, not draws the side. Default value is default line style (empty array). + *
      + *
    • all: Line style of all sides. Array like for + * SetLineStyle().
    • + *
    • 0 to (n - 1): Line style of each side. Array like for SetLineStyle().
    • + *
    + * If a key is not present or is null, not draws the side. Default value is default line style (empty array). * @param $fill_color (array) Fill color. Format: array(red, green, blue). Default value: default color (empty array). * @param $circle_style (string) Style of rendering of inscribed circle (if draws). Possible values are: - *
      - *
    • D or empty string: Draw (default).
    • - *
    • F: Fill.
    • - *
    • DF or FD: Draw and fill.
    • - *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • - *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • - *
    + *
      + *
    • D or empty string: Draw (default).
    • + *
    • F: Fill.
    • + *
    • DF or FD: Draw and fill.
    • + *
    • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
    • + *
    • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
    • + *
    * @param $circle_outLine_style (array) Line style of inscribed circle (if draws). Array like for SetLineStyle(). Default value: default line style (empty array). * @param $circle_fill_color (array) Fill color of inscribed circle (if draws). Format: array(red, green, blue). Default value: default color (empty array). * @public * @since 2.1.000 (2008-01-08) */ - public function StarPolygon($x0, $y0, $r, $nv, $ng, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array()) { + public function StarPolygon($x0, $y0, $r, $nv, $ng, $angle = 0, $draw_circle = false, $style = '', $line_style = array(), $fill_color = array(), $circle_style = '', $circle_outLine_style = array(), $circle_fill_color = array()) + { if ($nv < 2) { $nv = 2; } @@ -12109,7 +12355,8 @@ class TCPDF { * @public * @since 2.1.000 (2008-01-08) */ - public function RoundedRect($x, $y, $w, $h, $r, $round_corner='1111', $style='', $border_style=array(), $fill_color=array()) { + public function RoundedRect($x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array()) + { $this->RoundedRectXY($x, $y, $w, $h, $r, $r, $round_corner, $style, $border_style, $fill_color); } @@ -12128,7 +12375,8 @@ class TCPDF { * @public * @since 4.9.019 (2010-04-22) */ - public function RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner='1111', $style='', $border_style=array(), $fill_color=array()) { + public function RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner = '1111', $style = '', $border_style = array(), $fill_color = array()) + { if ($this->state != 2) { return; } @@ -12198,7 +12446,8 @@ class TCPDF { * @author Piotr Galecki, Nicola Asuni, Andy Meier * @since 4.6.018 (2009-07-10) */ - public function Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15) { + public function Arrow($x0, $y0, $x1, $y1, $head_style = 0, $arm_size = 5, $arm_angle = 15) + { // getting arrow direction angle // 0 deg angle is when both arms go along X axis. angle grows clockwise. $dir_angle = atan2(($y0 - $y1), ($x0 - $x1)); @@ -12263,7 +12512,8 @@ class TCPDF { * @author Christian Deligant, Nicola Asuni * @since 5.9.097 (2011-06-23) */ - public function setDestination($name, $y=-1, $page='', $x=-1) { + public function setDestination($name, $y = -1, $page = '', $x = -1) + { // remove unsupported characters $name = TCPDF_STATIC::encodeNameObject($name); if (TCPDF_STATIC::empty_string($name)) { @@ -12306,7 +12556,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.097 (2011-06-23) */ - public function getDestination() { + public function getDestination() + { return $this->dests; } @@ -12316,13 +12567,14 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 5.9.098 (2011-06-23) */ - protected function _putdests() { + protected function _putdests() + { if (empty($this->dests)) { return; } $this->n_dests = $this->_newobj(); $out = ' <<'; - foreach($this->dests as $name => $o) { + foreach ($this->dests as $name => $o) { $out .= ' /'.$name.' '.sprintf('[%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o['p'])], ($o['x'] * $this->k), ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); } $out .= ' >>'; @@ -12342,7 +12594,8 @@ class TCPDF { * @param $link (mixed) URL, or numerical link ID, or named destination (# character followed by the destination name), or embedded file (* character followed by the file name). * @public */ - public function setBookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1, $link='') { + public function setBookmark($txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '') + { $this->Bookmark($txt, $level, $y, $page, $style, $color, $x, $link); } @@ -12359,7 +12612,8 @@ class TCPDF { * @public * @since 2.1.002 (2008-02-12) */ - public function Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0), $x=-1, $link='') { + public function Bookmark($txt, $level = 0, $y = -1, $page = '', $style = '', $color = array(0,0,0), $x = -1, $link = '') + { if ($level < 0) { $level = 0; } @@ -12406,7 +12660,8 @@ class TCPDF { * @protected * @since 5.9.119 (2011-09-19) */ - protected function sortBookmarks() { + protected function sortBookmarks() + { // get sorting columns $outline_p = array(); $outline_y = array(); @@ -12424,7 +12679,8 @@ class TCPDF { * @author Olivier Plathey, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _putbookmarks() { + protected function _putbookmarks() + { $nb = count($this->outlines); if ($nb == 0) { return; @@ -12550,7 +12806,8 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - public function IncludeJS($script) { + public function IncludeJS($script) + { $this->javascript .= $script; } @@ -12563,7 +12820,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function addJavascriptObject($script, $onload=false) { + public function addJavascriptObject($script, $onload = false) + { if ($this->pdfa_mode) { // javascript is not allowed in PDF/A mode return false; @@ -12579,7 +12837,8 @@ class TCPDF { * @author Johannes G\FCntert, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _putjavascript() { + protected function _putjavascript() + { if ($this->pdfa_mode OR (empty($this->javascript) AND empty($this->js_objects))) { return; } @@ -12637,7 +12896,8 @@ class TCPDF { * @author Denis Van Nuffelen, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - protected function _addfield($type, $name, $x, $y, $w, $h, $prop) { + protected function _addfield($type, $name, $x, $y, $w, $h, $prop) + { if ($this->rtl) { $x = $x - $w; } @@ -12646,7 +12906,7 @@ class TCPDF { $k = $this->k; $this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n"; $this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n"; - foreach($prop as $key => $val) { + foreach ($prop as $key => $val) { if (strcmp(substr($key, -5), 'Color') == 0) { $val = TCPDF_COLORS::_JScolor($val); } else { @@ -12673,7 +12933,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-06) */ - public function setFormDefaultProp($prop=array()) { + public function setFormDefaultProp($prop = array()) + { $this->default_form_prop = $prop; } @@ -12684,7 +12945,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-06) */ - public function getFormDefaultProp() { + public function getFormDefaultProp() + { return $this->default_form_prop; } @@ -12702,7 +12964,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function TextField($name, $w, $h, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function TextField($name, $w, $h, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12823,7 +13086,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x='', $y='', $js=false) { + public function RadioButton($name, $w, $prop = array(), $opt = array(), $onvalue = 'On', $checked = false, $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12926,7 +13190,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function ListBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -12960,7 +13225,7 @@ class TCPDF { $popt['ap'] = array(); $popt['ap']['n'] = '/Tx BMC q '.$fontstyle.' '; $text = ''; - foreach($values as $item) { + foreach ($values as $item) { if (is_array($item)) { $text .= $item[1]."\n"; } else { @@ -13012,7 +13277,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function ComboBox($name, $w, $h, $values, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13047,7 +13313,7 @@ class TCPDF { $popt['ap'] = array(); $popt['ap']['n'] = '/Tx BMC q '.$fontstyle.' '; $text = ''; - foreach($values as $item) { + foreach ($values as $item) { if (is_array($item)) { $text .= $item[1]."\n"; } else { @@ -13099,7 +13365,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $x='', $y='', $js=false) { + public function CheckBox($name, $w, $checked = false, $prop = array(), $opt = array(), $onvalue = 'Yes', $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13179,7 +13446,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.000 (2009-09-07) */ - public function Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x='', $y='', $js=false) { + public function Button($name, $w, $h, $caption, $action, $prop = array(), $opt = array(), $x = '', $y = '', $js = false) + { if ($x === '') { $x = $this->x; } @@ -13346,7 +13614,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.6.008 (2009-05-07) */ - protected function _putsignature() { + protected function _putsignature() + { if ((!$this->sign) OR (!isset($this->signature_data['cert_type']))) { return; } @@ -13428,20 +13697,21 @@ class TCPDF { * @param $form (string) Names specifying additional form-field-related usage rights for the document. Valid names are: /Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate * @param $signature (string) Names specifying additional signature-related usage rights for the document. The only defined value is /Modify, which permits a user to apply a digital signature to an existing signature form field or clear a signed signature form field. * @param $ef (string) Names specifying additional usage rights for named embedded files in the document. Valid names are /Create/Delete/Modify/Import, which permit the user to perform the named operation on named embedded files - Names specifying additional embedded-files-related usage rights for the document. + Names specifying additional embedded-files-related usage rights for the document. * @param $formex (string) Names specifying additional form-field-related usage rights. The only valid name is BarcodePlaintext, which permits text form field data to be encoded as a plaintext two-dimensional barcode. * @public * @author Nicola Asuni * @since 2.9.000 (2008-03-26) */ public function setUserRights( - $enable=true, - $document='/FullSave', - $annots='/Create/Delete/Modify/Copy/Import/Export', - $form='/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', - $signature='/Modify', - $ef='/Create/Delete/Modify/Import', - $formex='') { + $enable = true, + $document = '/FullSave', + $annots = '/Create/Delete/Modify/Copy/Import/Export', + $form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', + $signature = '/Modify', + $ef = '/Create/Delete/Modify/Import', + $formex = '' + ) { $this->ur['enabled'] = $enable; $this->ur['document'] = $document; $this->ur['annots'] = $annots; @@ -13471,7 +13741,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.6.005 (2009-04-24) */ - public function setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array(), $approval='') { + public function setSignature($signing_cert = '', $private_key = '', $private_key_password = '', $extracerts = '', $cert_type = 2, $info = array(), $approval = '') + { // to create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt // to export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 // to convert pfx certificate to pem: openssl @@ -13508,7 +13779,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.3.011 (2010-06-17) */ - public function setSignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + public function setSignatureAppearance($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { $this->signature_appearance = $this->getSignatureAppearanceArray($x, $y, $w, $h, $page, $name); } @@ -13524,7 +13796,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.101 (2011-07-06) */ - public function addEmptySignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + public function addEmptySignatureAppearance($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { ++$this->n; $this->empty_signature_appearance[] = array('objid' => $this->n) + $this->getSignatureAppearanceArray($x, $y, $w, $h, $page, $name); } @@ -13542,7 +13815,8 @@ class TCPDF { * @author Nicola Asuni * @since 5.9.101 (2011-07-06) */ - protected function getSignatureAppearanceArray($x=0, $y=0, $w=0, $h=0, $page=-1, $name='') { + protected function getSignatureAppearanceArray($x = 0, $y = 0, $w = 0, $h = 0, $page = -1, $name = '') + { $sigapp = array(); if (($page < 1) OR ($page > $this->numpages)) { $sigapp['page'] = $this->page; @@ -13574,7 +13848,8 @@ class TCPDF { * @author Richard Stockinger * @since 6.0.090 (2014-06-16) */ - public function setTimeStamp($tsa_host='', $tsa_username='', $tsa_password='', $tsa_cert='') { + public function setTimeStamp($tsa_host = '', $tsa_username = '', $tsa_password = '', $tsa_cert = '') + { $this->tsa_data = array(); if (!function_exists('curl_init')) { $this->Error('Please enable cURL PHP extension!'); @@ -13602,7 +13877,8 @@ class TCPDF { * @author Richard Stockinger * @since 6.0.090 (2014-06-16) */ - protected function applyTSA($signature) { + protected function applyTSA($signature) + { if (!$this->tsa_timestamp) { return $signature; } @@ -13617,7 +13893,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function startPageGroup($page='') { + public function startPageGroup($page = '') + { if (empty($page)) { $page = $this->page + 1; } @@ -13630,7 +13907,8 @@ class TCPDF { * @since 5.9.093 (2011-06-16) * @public */ - public function setStartingPageNumber($num=1) { + public function setStartingPageNumber($num = 1) + { $this->starting_page_number = max(0, intval($num)); } @@ -13641,7 +13919,8 @@ class TCPDF { * @since 5.9.099 (2011-06-27) * @public */ - public function getAliasRightShift() { + public function getAliasRightShift() + { // calculate aproximatively the ratio between widths of aliases and replacements. $ref = '{'.TCPDF_STATIC::$alias_right_shift.'}{'.TCPDF_STATIC::$alias_tot_pages.'}{'.TCPDF_STATIC::$alias_num_page.'}'; $rep = str_repeat(' ', $this->GetNumChars($ref)); @@ -13667,7 +13946,8 @@ class TCPDF { * @since 4.0.018 (2008-08-08) * @public */ - public function getAliasNbPages() { + public function getAliasNbPages() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_tot_pages.'}'; } @@ -13682,7 +13962,8 @@ class TCPDF { * @since 4.5.000 (2009-01-02) * @public */ - public function getAliasNumPage() { + public function getAliasNumPage() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_num_page.'}'; } @@ -13697,7 +13978,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function getPageGroupAlias() { + public function getPageGroupAlias() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_group_tot_pages.'}'; } @@ -13712,7 +13994,8 @@ class TCPDF { * @public * @since 4.5.000 (2009-01-02) */ - public function getPageNumGroupAlias() { + public function getPageNumGroupAlias() + { if ($this->isUnicodeFont()) { return '{'.TCPDF_STATIC::$alias_group_num_page.'}'; } @@ -13725,7 +14008,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function getGroupPageNo() { + public function getGroupPageNo() + { return $this->pagegroups[$this->currpagegroup]; } @@ -13735,7 +14019,8 @@ class TCPDF { * @since 4.3.003 (2008-11-18) * @see PaneNo(), formatPageNumber() */ - public function getGroupPageNoFormatted() { + public function getGroupPageNoFormatted() + { return TCPDF_STATIC::formatPageNumber($this->getGroupPageNo()); } @@ -13745,7 +14030,8 @@ class TCPDF { * @since 4.2.005 (2008-11-06) * @see PaneNo(), formatPageNumber() */ - public function PageNoFormatted() { + public function PageNoFormatted() + { return TCPDF_STATIC::formatPageNumber($this->PageNo()); } @@ -13754,7 +14040,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function _putocg() { + protected function _putocg() + { if (empty($this->pdflayers)) { return; } @@ -13763,9 +14050,9 @@ class TCPDF { $out = '<< /Type /OCG'; $out .= ' /Name '.$this->_textstring($layer['name'], $this->pdflayers[$key]['objid']); $out .= ' /Usage <<'; - if (isset($layer['print']) AND ($layer['print'] !== NULL)) { + if (isset($layer['print']) AND ($layer['print'] !== null)) { $out .= ' /Print <>'; - } + } $out .= ' /View <>'; $out .= ' >> >>'; $out .= "\n".'endobj'; @@ -13782,7 +14069,8 @@ class TCPDF { * @public * @since 5.9.102 (2011-07-13) */ - public function startLayer($name='', $print=true, $view=true, $lock=true) { + public function startLayer($name = '', $print = true, $view = true, $lock = true) + { if ($this->state != 2) { return; } @@ -13802,7 +14090,8 @@ class TCPDF { * @public * @since 5.9.102 (2011-07-13) */ - public function endLayer() { + public function endLayer() + { if ($this->state != 2) { return; } @@ -13821,12 +14110,13 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setVisibility($v) { + public function setVisibility($v) + { if ($this->state != 2) { return; } $this->endLayer(); - switch($v) { + switch ($v) { case 'print': { $this->startLayer('Print', true, false); break; @@ -13854,7 +14144,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function addExtGState($parms) { + protected function addExtGState($parms) + { if ($this->pdfa_mode) { // transparencies are not allowed in PDF/A mode return; @@ -13885,7 +14176,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function setExtGState($gs) { + protected function setExtGState($gs) + { if ($this->pdfa_mode OR ($this->state != 2)) { // transparency is not allowed in PDF/A mode return; @@ -13898,7 +14190,8 @@ class TCPDF { * @protected * @since 3.0.000 (2008-03-27) */ - protected function _putextgstates() { + protected function _putextgstates() + { foreach ($this->extgstates as $i => $ext) { $this->extgstates[$i]['n'] = $this->_newobj(); $out = '<< /Type /ExtGState'; @@ -13927,7 +14220,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function setOverprint($stroking=true, $nonstroking='', $mode=0) { + public function setOverprint($stroking = true, $nonstroking = '', $mode = 0) + { if ($this->state != 2) { return; } @@ -13953,7 +14247,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getOverprint() { + public function getOverprint() + { return $this->overprint; } @@ -13966,7 +14261,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setAlpha($stroking=1, $bm='Normal', $nonstroking='', $ais=false) { + public function setAlpha($stroking = 1, $bm = 'Normal', $nonstroking = '', $ais = false) + { if ($this->pdfa_mode) { // transparency is not allowed in PDF/A mode return; @@ -13998,7 +14294,8 @@ class TCPDF { * @public * @since 5.9.152 (2012-03-23) */ - public function getAlpha() { + public function getAlpha() + { return $this->alpha; } @@ -14008,7 +14305,8 @@ class TCPDF { * @public * @since 3.0.000 (2008-03-27) */ - public function setJPEGQuality($quality) { + public function setJPEGQuality($quality) + { if (($quality < 1) OR ($quality > 100)) { $quality = 75; } @@ -14021,7 +14319,8 @@ class TCPDF { * @public * @since 3.0.014 (2008-06-04) */ - public function setDefaultTableColumns($cols=4) { + public function setDefaultTableColumns($cols = 4) + { $this->default_table_columns = intval($cols); } @@ -14031,7 +14330,8 @@ class TCPDF { * @public * @since 3.0.014 (2008-06-04) */ - public function setCellHeightRatio($h) { + public function setCellHeightRatio($h) + { $this->cell_height_ratio = $h; } @@ -14040,7 +14340,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getCellHeightRatio() { + public function getCellHeightRatio() + { return $this->cell_height_ratio; } @@ -14050,7 +14351,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-09) */ - public function setPDFVersion($version='1.7') { + public function setPDFVersion($version = '1.7') + { if ($this->pdfa_mode && $this->pdfa_version == 1 ) { // PDF/A mode $this->PDFVersion = '1.4'; @@ -14068,7 +14370,8 @@ class TCPDF { * @public * @since 3.1.000 (2008-06-09) */ - public function setViewerPreferences($preferences) { + public function setViewerPreferences($preferences) + { $this->viewer_preferences = $preferences; } @@ -14085,7 +14388,8 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function colorRegistrationBar($x, $y, $w, $h, $transition=true, $vertical=false, $colors='A,R,G,B,C,M,Y,K') { + public function colorRegistrationBar($x, $y, $w, $h, $transition = true, $vertical = false, $colors = 'A,R,G,B,C,M,Y,K') + { if (strpos($colors, 'ALLSPOT') !== false) { // expand spot colors $spot_colors = ''; @@ -14225,7 +14529,8 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function cropMark($x, $y, $w, $h, $type='T,R,B,L', $color=array(100,100,100,100,'All')) { + public function cropMark($x, $y, $w, $h, $type = 'T,R,B,L', $color = array(100,100,100,100,'All')) + { $this->SetLineStyle(array('width' => (0.5 / $this->k), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $color)); $type = strtoupper($type); $type = preg_replace('/[^A-Z\-\,]*/', '', $type); @@ -14296,8 +14601,9 @@ class TCPDF { * @since 4.9.000 (2010-03-26) * @public */ - public function registrationMark($x, $y, $r, $double=false, $cola=array(100,100,100,100,'All'), $colb=array(0,0,0,0,'None')) { - $line_style = array('width' => max((0.5 / $this->k),($r / 30)), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $cola); + public function registrationMark($x, $y, $r, $double = false, $cola = array(100,100,100,100,'All'), $colb = array(0,0,0,0,'None')) + { + $line_style = array('width' => max((0.5 / $this->k), ($r / 30)), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $cola); $this->SetFillColorArray($cola); $this->PieSector($x, $y, $r, 90, 180, 'F'); $this->PieSector($x, $y, $r, 270, 360, 'F'); @@ -14323,9 +14629,10 @@ class TCPDF { * @since 6.0.038 (2013-09-30) * @public */ - public function registrationMarkCMYK($x, $y, $r) { + public function registrationMarkCMYK($x, $y, $r) + { // line width - $lw = max((0.5 / $this->k),($r / 8)); + $lw = max((0.5 / $this->k), ($r / 8)); // internal radius $ri = ($r * 0.6); // external radius @@ -14367,7 +14674,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function LinearGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0,0,1,0)) { + public function LinearGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0,0,1,0)) + { $this->Clip($x, $y, $w, $h); $this->Gradient(2, $coords, array(array('color' => $col1, 'offset' => 0, 'exponent' => 1), array('color' => $col2, 'offset' => 1, 'exponent' => 1)), array(), false); } @@ -14385,7 +14693,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function RadialGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0.5,0.5,0.5,0.5,1)) { + public function RadialGradient($x, $y, $w, $h, $col1 = array(), $col2 = array(), $coords = array(0.5,0.5,0.5,0.5,1)) + { $this->Clip($x, $y, $w, $h); $this->Gradient(3, $coords, array(array('color' => $col1, 'offset' => 0, 'exponent' => 1), array('color' => $col2, 'offset' => 1, 'exponent' => 1)), array(), false); } @@ -14408,7 +14717,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function CoonsPatchMesh($x, $y, $w, $h, $col1=array(), $col2=array(), $col3=array(), $col4=array(), $coords=array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min=0, $coords_max=1, $antialias=false) { + public function CoonsPatchMesh($x, $y, $w, $h, $col1 = array(), $col2 = array(), $col3 = array(), $col4 = array(), $coords = array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min = 0, $coords_max = 1, $antialias = false) + { if ($this->pdfa_mode OR ($this->state != 2)) { return; } @@ -14500,7 +14810,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - protected function Clip($x, $y, $w, $h) { + protected function Clip($x, $y, $w, $h) + { if ($this->state != 2) { return; } @@ -14527,7 +14838,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function Gradient($type, $coords, $stops, $background=array(), $antialias=false) { + public function Gradient($type, $coords, $stops, $background = array(), $antialias = false) + { if ($this->pdfa_mode OR ($this->state != 2)) { return; } @@ -14541,7 +14853,7 @@ class TCPDF { // color space $numcolspace = count($stops[0]['color']); $bcolor = array_values($background); - switch($numcolspace) { + switch ($numcolspace) { case 5: // SPOT case 4: { // CMYK $this->gradients[$n]['colspace'] = 'DeviceCMYK'; @@ -14598,7 +14910,7 @@ class TCPDF { } // set colors $color = array_values($stop['color']); - switch($numcolspace) { + switch ($numcolspace) { case 5: // SPOT case 4: { // CMYK $this->gradients[$n]['colors'][$key]['color'] = sprintf('%F %F %F %F', $color[0]/100, $color[1]/100, $color[2]/100, $color[3]/100); @@ -14634,7 +14946,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @protected */ - function _putshaders() { + function _putshaders() + { if ($this->pdfa_mode) { return; } @@ -14826,7 +15139,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function PieSector($xc, $yc, $r, $a, $b, $style='FD', $cw=true, $o=90) { + public function PieSector($xc, $yc, $r, $a, $b, $style = 'FD', $cw = true, $o = 90) + { $this->PieSectorXY($xc, $yc, $r, $r, $a, $b, $style, $cw, $o); } @@ -14847,7 +15161,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style='FD', $cw=false, $o=0, $nc=2) { + public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style = 'FD', $cw = false, $o = 0, $nc = 2) + { if ($this->state != 2) { return; } @@ -14891,7 +15206,8 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function ImageEps($file, $x='', $y='', $w=0, $h=0, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false, $fixoutvals=false) { + public function ImageEps($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $useBoundingBox = true, $align = '', $palign = '', $border = 0, $fitonpage = false, $fixoutvals = false) + { if ($this->state != 2) { return; } @@ -14913,17 +15229,17 @@ class TCPDF { } else { // EPS/AI file $data = TCPDF_STATIC::fileGetContents($file); } - if ($data === FALSE) { + if ($data === false) { $this->Error('EPS file not found: '.$file); } $regs = array(); // EPS/AI compatibility check (only checks files created by Adobe Illustrator!) - preg_match("/%%Creator:([^\r\n]+)/", $data, $regs); # find Creator + preg_match("/%%Creator:([^\r\n]+)/", $data, $regs); // find Creator if (count($regs) > 1) { - $version_str = trim($regs[1]); # e.g. "Adobe Illustrator(R) 8.0" + $version_str = trim($regs[1]); // e.g. "Adobe Illustrator(R) 8.0" if (strpos($version_str, 'Adobe Illustrator') !== false) { $versexp = explode(' ', $version_str); - $version = (float)array_pop($versexp); + $version = (float) array_pop($versexp); if ($version >= 9) { $this->Error('This version of Adobe Illustrator file is not supported: '.$file); } @@ -15178,7 +15494,7 @@ class TCPDF { $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15210,7 +15526,8 @@ class TCPDF { * @param $bc (string) barcode * @public */ - public function setBarcode($bc='') { + public function setBarcode($bc = '') + { $this->barcode = $bc; } @@ -15220,7 +15537,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getBarcode() { + public function getBarcode() + { return $this->barcode; } @@ -15234,31 +15552,32 @@ class TCPDF { * @param $h (int) height in user units (empty string = remaining page height) * @param $xres (float) width of the smallest bar in user units (empty string = default value = 0.4mm) * @param $style (array) array of options:
      - *
    • boolean $style['border'] if true prints a border
    • - *
    • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
    • - *
    • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
    • - *
    • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
    • - *
    • array $style['fgcolor'] color array for bars and text
    • - *
    • mixed $style['bgcolor'] color array for background (set to false for transparent)
    • - *
    • boolean $style['text'] if true prints text below the barcode
    • - *
    • string $style['label'] override default label
    • - *
    • string $style['font'] font name for text
    • int $style['fontsize'] font size for text
    • - *
    • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
    • - *
    • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
    • - *
    • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
    • - *
    • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
    • - *
    • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
    • - *
    • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
    + *
  • boolean $style['border'] if true prints a border
  • + *
  • int $style['padding'] padding to leave around the barcode in user units (set to 'auto' for automatic padding)
  • + *
  • int $style['hpadding'] horizontal padding in user units (set to 'auto' for automatic padding)
  • + *
  • int $style['vpadding'] vertical padding in user units (set to 'auto' for automatic padding)
  • + *
  • array $style['fgcolor'] color array for bars and text
  • + *
  • mixed $style['bgcolor'] color array for background (set to false for transparent)
  • + *
  • boolean $style['text'] if true prints text below the barcode
  • + *
  • string $style['label'] override default label
  • + *
  • string $style['font'] font name for text
  • int $style['fontsize'] font size for text
  • + *
  • int $style['stretchtext']: 0 = disabled; 1 = horizontal scaling only if necessary; 2 = forced horizontal scaling; 3 = character spacing only if necessary; 4 = forced character spacing.
  • + *
  • string $style['position'] horizontal position of the containing barcode cell on the page: L = left margin; C = center; R = right margin.
  • + *
  • string $style['align'] horizontal position of the barcode on the containing rectangle: L = left; C = center; R = right.
  • + *
  • string $style['stretch'] if true stretch the barcode to best fit the available width, otherwise uses $xres resolution for a single bar.
  • + *
  • string $style['fitwidth'] if true reduce the width to fit the barcode width + padding. When this option is enabled the 'stretch' option is automatically disabled.
  • + *
  • string $style['cellfitalign'] this option works only when 'fitwidth' is true and 'position' is unset or empty. Set the horizontal position of the containing barcode cell inside the specified rectangle: L = left; C = center; R = right.
  • * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
    • T: top-right for LTR or top-left for RTL
    • M: middle-right for LTR or middle-left for RTL
    • B: bottom-right for LTR or bottom-left for RTL
    • N: next line
    * @author Nicola Asuni * @since 3.1.000 (2008-06-09) * @public */ - public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') { + public function write1DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $xres = '', $style = array(), $align = '') + { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_1d.php'); + require_once dirname(__FILE__).'/tcpdf_barcodes_1d.php'; // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -15521,7 +15840,7 @@ class TCPDF { // restore previous settings $this->setGraphicVars($gvars); // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15557,26 +15876,27 @@ class TCPDF { * @param $w (int) width in user units * @param $h (int) height in user units * @param $style (array) array of options:
      - *
    • boolean $style['border'] if true prints a border around the barcode
    • - *
    • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
    • - *
    • int $style['module_width'] width of a single module in points
    • - *
    • int $style['module_height'] height of a single module in points
    • - *
    • array $style['fgcolor'] color array for bars and text
    • - *
    • mixed $style['bgcolor'] color array for background or false for transparent
    • - *
    • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
    • + *
    • boolean $style['border'] if true prints a border around the barcode
    • + *
    • int $style['padding'] padding to leave around the barcode in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['hpadding'] horizontal padding in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['vpadding'] vertical padding in barcode units (set to 'auto' for automatic padding)
    • + *
    • int $style['module_width'] width of a single module in points
    • + *
    • int $style['module_height'] height of a single module in points
    • + *
    • array $style['fgcolor'] color array for bars and text
    • + *
    • mixed $style['bgcolor'] color array for background or false for transparent
    • + *
    • string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch
    • * @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:
      • T: top-right for LTR or top-left for RTL
      • M: middle-right for LTR or middle-left for RTL
      • B: bottom-right for LTR or bottom-left for RTL
      • N: next line
      * @param $distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio * @author Nicola Asuni * @since 4.5.037 (2009-04-07) * @public */ - public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) { + public function write2DBarcode($code, $type, $x = '', $y = '', $w = '', $h = '', $style = array(), $align = '', $distort = false) + { if (TCPDF_STATIC::empty_string(trim($code))) { return; } - require_once(dirname(__FILE__).'/tcpdf_barcodes_2d.php'); + require_once dirname(__FILE__).'/tcpdf_barcodes_2d.php'; // save current graphic settings $gvars = $this->getGraphicVars(); // create new barcode object @@ -15634,7 +15954,7 @@ class TCPDF { // number of barcode columns and rows $rows = $arrcode['num_rows']; $cols = $arrcode['num_cols']; - if (($rows <= 0) || ($cols <= 0)){ + if (($rows <= 0) || ($cols <= 0)) { $this->Error('Error in 2D barcode string'); } // module width and height @@ -15755,7 +16075,7 @@ class TCPDF { // restore previous settings $this->setGraphicVars($gvars); // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -15801,7 +16121,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getMargins() { + public function getMargins() + { $ret = array( 'left' => $this->lMargin, 'right' => $this->rMargin, @@ -15828,7 +16149,8 @@ class TCPDF { * @public * @since 4.0.012 (2008-07-24) */ - public function getOriginalMargins() { + public function getOriginalMargins() + { $ret = array( 'left' => $this->original_lMargin, 'right' => $this->original_rMargin @@ -15842,7 +16164,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getFontSize() { + public function getFontSize() + { return $this->FontSize; } @@ -15852,7 +16175,8 @@ class TCPDF { * @public * @since 3.2.000 (2008-06-23) */ - public function getFontSizePt() { + public function getFontSizePt() + { return $this->FontSizePt; } @@ -15862,7 +16186,8 @@ class TCPDF { * @public * @since 4.3.008 (2008-12-05) */ - public function getFontFamily() { + public function getFontFamily() + { return $this->FontFamily; } @@ -15872,7 +16197,8 @@ class TCPDF { * @public * @since 4.3.008 (2008-12-05) */ - public function getFontStyle() { + public function getFontStyle() + { return $this->FontStyle; } @@ -15888,7 +16214,8 @@ class TCPDF { * @since 5.9.017 (2010-11-16) * @see setHtmlVSpace() */ - public function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='') { + public function fixHTMLCode($html, $default_css = '', $tagvs = '', $tidy_options = '') + { return TCPDF_STATIC::fixHTMLCode($html, $default_css, $tagvs, $tidy_options, $this->tagvspaces); } @@ -15899,7 +16226,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderWidth($width) { + protected function getCSSBorderWidth($width) + { if ($width == 'thin') { $width = (2 / $this->k); } elseif ($width == 'medium') { @@ -15919,7 +16247,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderDashStyle($style) { + protected function getCSSBorderDashStyle($style) + { switch (strtolower($style)) { case 'none': case 'hidden': { @@ -15955,7 +16284,8 @@ class TCPDF { * @protected * @since 5.7.000 (2010-08-02) */ - protected function getCSSBorderStyle($cssborder) { + protected function getCSSBorderStyle($cssborder) + { $bprop = preg_split('/[\s]+/', trim($cssborder)); $border = array(); // value to be returned switch (count($bprop)) { @@ -16006,7 +16336,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-04) */ - public function getCSSPadding($csspadding, $width=0) { + public function getCSSPadding($csspadding, $width = 0) + { $padding = preg_split('/[\s]+/', trim($csspadding)); $cell_padding = array(); // value to be returned switch (count($padding)) { @@ -16060,7 +16391,8 @@ class TCPDF { * @public * @since 5.9.000 (2010-10-04) */ - public function getCSSMargin($cssmargin, $width=0) { + public function getCSSMargin($cssmargin, $width = 0) + { $margin = preg_split('/[\s]+/', trim($cssmargin)); $cell_margin = array(); // value to be returned switch (count($margin)) { @@ -16114,7 +16446,8 @@ class TCPDF { * @public * @since 5.9.010 (2010-10-27) */ - public function getCSSBorderMargin($cssbspace, $width=0) { + public function getCSSBorderMargin($cssbspace, $width = 0) + { $space = preg_split('/[\s]+/', trim($cssbspace)); $border_spacing = array(); // value to be returned switch (count($space)) { @@ -16148,7 +16481,8 @@ class TCPDF { * @protected * @since 5.9.000 (2010-10-02) */ - protected function getCSSFontSpacing($spacing, $parent=0) { + protected function getCSSFontSpacing($spacing, $parent = 0) + { $val = 0; // value to be returned $spacing = trim($spacing); switch ($spacing) { @@ -16179,7 +16513,8 @@ class TCPDF { * @protected * @since 5.9.000 (2010-10-02) */ - protected function getCSSFontStretching($stretch, $parent=100) { + protected function getCSSFontStretching($stretch, $parent = 100) + { $val = 100; // value to be returned $stretch = trim($stretch); switch ($stretch) { @@ -16251,7 +16586,8 @@ class TCPDF { * @return float value in points * @public */ - public function getHTMLFontUnits($val, $refsize=12, $parent_size=12, $defaultunit='pt') { + public function getHTMLFontUnits($val, $refsize = 12, $parent_size = 12, $defaultunit = 'pt') + { $refsize = TCPDF_FONTS::getFontRefSize($refsize); $parent_size = TCPDF_FONTS::getFontRefSize($parent_size, $refsize); switch ($val) { @@ -16305,7 +16641,8 @@ class TCPDF { * @protected * @since 3.2.000 (2008-06-20) */ - protected function getHtmlDomArray($html) { + protected function getHtmlDomArray($html) + { // array of CSS styles ( selector => properties). $css = array(); // get CSS array defined at previous call @@ -16331,7 +16668,7 @@ class TCPDF { if (preg_match('/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) { // read CSS data file $cssdata = TCPDF_STATIC::fileGetContents(trim($type[1])); - if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) { + if (($cssdata !== false) AND (strlen($cssdata) > 0)) { $css = array_merge($css, TCPDF_STATIC::extractCSSproperties($cssdata)); } } @@ -16608,9 +16945,9 @@ class TCPDF { // get attributes preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER); $dom[$key]['attribute'] = array(); // reset attribute array - foreach($attr_array[1] as $id => $name) { - $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; - } + foreach ($attr_array[1] as $id => $name) { + $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; + } if (!empty($css)) { // merge CSS style to current style list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css); @@ -16621,10 +16958,10 @@ class TCPDF { // get style attributes preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER); $dom[$key]['style'] = array(); // reset style attribute array - foreach($style_array[1] as $id => $name) { - // in case of duplicate attribute the last replace the previous - $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); - } + foreach ($style_array[1] as $id => $name) { + // in case of duplicate attribute the last replace the previous + $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); + } // --- get some style attributes --- // text direction if (isset($dom[$key]['style']['direction'])) { @@ -17093,7 +17430,8 @@ class TCPDF { * @author Nicola Asuni * @since 4.8.024 (2010-01-15) */ - protected function getSpaceString() { + protected function getSpaceString() + { $spacestr = chr(32); if ($this->isUnicodeFont()) { $spacestr = chr(0).chr(32); @@ -17107,7 +17445,8 @@ class TCPDF { * @return string * @public static */ - protected function getHashForTCPDFtagParams($data) { + protected function getHashForTCPDFtagParams($data) + { return md5(strlen($data).$this->file_id.$data); } @@ -17117,7 +17456,8 @@ class TCPDF { * @return string containing serialized data * @public static */ - public function serializeTCPDFtagParameters($data) { + public function serializeTCPDFtagParameters($data) + { $encoded = urlencode(json_encode($data)); return $this->getHashForTCPDFtagParams($encoded).$encoded; } @@ -17128,7 +17468,8 @@ class TCPDF { * @return array containing unserialized data * @protected static */ - protected function unserializeTCPDFtagParameters($data) { + protected function unserializeTCPDFtagParameters($data) + { $hash = substr($data, 0, 32); $encoded = substr($data, 32); if ($hash != $this->getHashForTCPDFtagParams($encoded)) { @@ -17150,8 +17491,7 @@ class TCPDF { * @param $y (float) upper-left corner Y coordinate * @param $html (string) html text to print. Default value: empty string. * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:
      • 0: no border (default)
      • 1: frame
      or a string containing some or all of the following characters (in any order):
      • L: left
      • T: top
      • R: right
      • B: bottom
      or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))) - * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
      • 0: to the right (or left for RTL language)
      • 1: to the beginning of the next line
      • 2: below
      -Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. + * @param $ln (int) Indicates where the current position should go after the call. Possible values are:
      • 0: to the right (or left for RTL language)
      • 1: to the beginning of the next line
      • 2: below
      Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false). * @param $reseth (boolean) if true reset the last cell height (default true). * @param $align (string) Allows to center or align the text. Possible values are:
      • L : left align
      • C : center
      • R : right align
      • '' : empty string : left for LTR or right for RTL
      @@ -17159,7 +17499,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @see Multicell(), writeHTML() * @public */ - public function writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopadding=true) { + public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true) + { return $this->MultiCell($w, $h, $html, $border, $align, $fill, $ln, $x, $y, $reseth, 0, true, $autopadding, 0, 'T', false); } @@ -17176,7 +17517,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $align (string) Allows to center or align the text. Possible values are:
      • L : left align
      • C : center
      • R : right align
      • '' : empty string : left for LTR or right for RTL
      * @public */ - public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') { + public function writeHTML($html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '') + { $gvars = $this->getGraphicVars(); // store current values $prev_cell_margin = $this->cell_margin; @@ -17834,7 +18176,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // justify block if (preg_match('/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s]('.$strpiece[2][0].')([\s]*)/x', $pmid, $pmatch) == 1) { - $newpmid = sprintf('%F',(floatval($pmatch[1]) + $spacew)).' '.$pmatch[2].' x*#!#*x'.$pmatch[3].$pmatch[4]; + $newpmid = sprintf('%F', (floatval($pmatch[1]) + $spacew)).' '.$pmatch[2].' x*#!#*x'.$pmatch[3].$pmatch[4]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid); } @@ -17879,8 +18221,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } if (preg_match('/('.$xmatches[1].')[\s]('.$xmatches[2].')[\s]('.$xmatches[3].')[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $pmatch) == 1) { - $newx = sprintf('%F',(floatval($pmatch[1]) + $x_diff)); - $neww = sprintf('%F',(floatval($pmatch[3]) + $w_diff)); + $newx = sprintf('%F', (floatval($pmatch[1]) + $x_diff)); + $neww = sprintf('%F', (floatval($pmatch[3]) + $w_diff)); $newpmid = $newx.' '.$pmatch[2].' '.$neww.' '.$pmatch[4].' x*#!#*x'.$pmatch[5].$pmatch[6]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid, $newx, $neww); @@ -17896,9 +18238,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $currentxpos = $xmatches[1]; // justify block if (preg_match('/('.$xmatches[1].')[\s]('.$xmatches[2].')[\s]('.$xmatches[3].')[\s]('.$xmatches[4].')[\s]('.$xmatches[5].')[\s]('.$strpiece[1][0].')[\s](c)([\s]*)/x', $pmid, $pmatch) == 1) { - $newx1 = sprintf('%F',(floatval($pmatch[1]) + $spacew)); - $newx2 = sprintf('%F',(floatval($pmatch[3]) + $spacew)); - $newx3 = sprintf('%F',(floatval($pmatch[5]) + $spacew)); + $newx1 = sprintf('%F', (floatval($pmatch[1]) + $spacew)); + $newx2 = sprintf('%F', (floatval($pmatch[3]) + $spacew)); + $newx3 = sprintf('%F', (floatval($pmatch[5]) + $spacew)); $newpmid = $newx1.' '.$pmatch[2].' '.$newx2.' '.$pmatch[4].' '.$newx3.' '.$pmatch[6].' x*#!#*x'.$pmatch[7].$pmatch[8]; $pmid = str_replace($pmatch[0], $newpmid, $pmid); unset($pmatch, $newpmid, $newx1, $newx2, $newx3); @@ -17950,13 +18292,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $pmid = preg_replace('/[\\\][\(]/x', '\\#!#OP#!#', $pmid); $pmid = preg_replace('/[\\\][\)]/x', '\\#!#CP#!#', $pmid); if (preg_match_all('/\[\(([^\)]*)\)\]/x', $pmid, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $replace = $pamatch[1][$pk]; $replace = str_replace('#!#OP#!#', '(', $replace); $replace = str_replace('#!#CP#!#', ')', $replace); $newpmid = '[('.str_replace(chr(0).chr(32), ') '.sprintf('%F', $spacew).' (', $replace).')]'; $pos = strpos($pmid, $pmatch, $pos); - if ($pos !== FALSE) { + if ($pos !== false) { $pmid = substr_replace($pmid, $newpmid, $pos, strlen($pmatch)); } ++$pos; @@ -18529,8 +18871,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $loop = 0; // add the positive font spacing of the last character (if any) - if ($this->font_spacing > 0) { - if ($this->rtl) { + if ($this->font_spacing > 0) { + if ($this->rtl) { $this->x -= $this->font_spacing; } else { $this->x += $this->font_spacing; @@ -18734,7 +19076,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @return $dom array * @protected */ - protected function openHTMLTagHandler($dom, $key, $cell) { + protected function openHTMLTagHandler($dom, $key, $cell) + { $tag = $dom[$key]; $parent = $dom[($dom[$key]['parent'])]; $firsttag = ($key == 1); @@ -18799,7 +19142,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // Opening tag - switch($tag['value']) { + switch ($tag['value']) { case 'table': { $cp = 0; $cs = 0; @@ -18900,8 +19243,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // convert URL to server path $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); } - } - elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + } elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { @@ -18936,7 +19278,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // further development is required for other modes. $tag['attribute']['align'] = 'bottom'; //} - switch($tag['attribute']['align']) { + switch ($tag['attribute']['align']) { case 'top': { $align = 'T'; break; @@ -18997,7 +19339,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $this->Image($imgsrc, $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); } - switch($align) { + switch ($align) { case 'T': { $this->y = $prevy; break; @@ -19440,7 +19782,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @return $dom array * @protected */ - protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { + protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney = 0) + { $tag = $dom[$key]; $parent = $dom[($dom[$key]['parent'])]; $lasttag = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value'] == 'marker'))); @@ -19481,7 +19824,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // Closing tag - switch($tag['value']) { + switch ($tag['value']) { case 'tr': { $table_el = $dom[($dom[$key]['parent'])]['parent']; if (!isset($parent['endy'])) { @@ -19570,394 +19913,394 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // closing tag used for the thead part $in_table_head = true; $this->inthead = false; - case 'table': { - $table_el = $parent; - // set default border - if (isset($table_el['attribute']['border']) AND ($table_el['attribute']['border'] > 0)) { + case 'table': { + $table_el = $parent; // set default border - $border = array('LTRB' => array('width' => $this->getCSSBorderWidth($table_el['attribute']['border']), 'cap'=>'square', 'join'=>'miter', 'dash'=> 0, 'color'=>array(0,0,0))); - } else { - $border = 0; - } - $default_border = $border; - // fix bottom line alignment of last line before page break - foreach ($dom[($dom[$key]['parent'])]['trids'] as $j => $trkey) { - // update row-spanned cells - if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { - foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { - if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] > 0)) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] = $trkey; - } - if ($dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] == $trkey) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; - } - } + if (isset($table_el['attribute']['border']) AND ($table_el['attribute']['border'] > 0)) { + // set default border + $border = array('LTRB' => array('width' => $this->getCSSBorderWidth($table_el['attribute']['border']), 'cap'=>'square', 'join'=>'miter', 'dash'=> 0, 'color'=>array(0,0,0))); + } else { + $border = 0; } - if (isset($prevtrkey) AND ($dom[$trkey]['startpage'] > $dom[$prevtrkey]['endpage'])) { - $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage']]['hk'] - $this->pagedim[$dom[$prevtrkey]['endpage']]['bm']; - $dom[$prevtrkey]['endy'] = $pgendy; + $default_border = $border; + // fix bottom line alignment of last line before page break + foreach ($dom[($dom[$key]['parent'])]['trids'] as $j => $trkey) { // update row-spanned cells if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { - if (($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] >= 0) AND ($trwsp['endpage'] == $dom[$prevtrkey]['endpage'])) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['endy'] = $pgendy; - $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] = -1; + if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] > 0)) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] = $trkey; + } + if ($dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] == $trkey) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; } } } - } - $prevtrkey = $trkey; - $table_el = $dom[($dom[$key]['parent'])]; - } - // for each row - if (count($table_el['trids']) > 0) { - unset($xmax); - } - foreach ($table_el['trids'] as $j => $trkey) { - $parent = $dom[$trkey]; - if (!isset($xmax)) { - $xmax = $parent['cellpos'][(count($parent['cellpos']) - 1)]['endx']; - } - // for each cell on the row - foreach ($parent['cellpos'] as $k => $cellpos) { - if (isset($cellpos['rowspanid']) AND ($cellpos['rowspanid'] >= 0)) { - $cellpos['startx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['startx']; - $cellpos['endx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['endx']; - $endy = $table_el['rowspans'][($cellpos['rowspanid'])]['endy']; - $startpage = $table_el['rowspans'][($cellpos['rowspanid'])]['startpage']; - $endpage = $table_el['rowspans'][($cellpos['rowspanid'])]['endpage']; - $startcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['startcolumn']; - $endcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['endcolumn']; - } else { - $endy = $parent['endy']; - $startpage = $parent['startpage']; - $endpage = $parent['endpage']; - $startcolumn = $parent['startcolumn']; - $endcolumn = $parent['endcolumn']; - } - if ($this->num_columns == 0) { - $this->num_columns = 1; - } - if (isset($cellpos['border'])) { - $border = $cellpos['border']; - } - if (isset($cellpos['bgcolor']) AND ($cellpos['bgcolor']) !== false) { - $this->SetFillColorArray($cellpos['bgcolor']); - $fill = true; - } else { - $fill = false; - } - $x = $cellpos['startx']; - $y = $parent['starty']; - $starty = $y; - $w = abs($cellpos['endx'] - $cellpos['startx']); - // get border modes - $border_start = TCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell); - $border_end = TCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell); - $border_middle = TCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell); - // design borders around HTML cells. - for ($page = $startpage; $page <= $endpage; ++$page) { // for each page - $ccode = ''; - $this->setPage($page); - if ($this->num_columns < 2) { - // single-column mode - $this->x = $x; - $this->y = $this->tMargin; - } - // account for margin changes - if ($page > $startpage) { - if (($this->rtl) AND ($this->pagedim[$page]['orm'] != $this->pagedim[$startpage]['orm'])) { - $this->x -= ($this->pagedim[$page]['orm'] - $this->pagedim[$startpage]['orm']); - } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm'] != $this->pagedim[$startpage]['olm'])) { - $this->x += ($this->pagedim[$page]['olm'] - $this->pagedim[$startpage]['olm']); + if (isset($prevtrkey) AND ($dom[$trkey]['startpage'] > $dom[$prevtrkey]['endpage'])) { + $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage']]['hk'] - $this->pagedim[$dom[$prevtrkey]['endpage']]['bm']; + $dom[$prevtrkey]['endy'] = $pgendy; + // update row-spanned cells + if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { + foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { + if (($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] >= 0) AND ($trwsp['endpage'] == $dom[$prevtrkey]['endpage'])) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['endy'] = $pgendy; + $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] = -1; + } } } - if ($startpage == $endpage) { // single page - $deltacol = 0; - $deltath = 0; - for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); - if ($startcolumn == $endcolumn) { // single column - $cborder = $border; - $h = $endy - $parent['starty']; - $this->y = $y; - $this->x = $x; - } elseif ($column == $startcolumn) { // first column - $cborder = $border_start; - $this->y = $starty; - $this->x = $x; - $h = $this->h - $this->y - $this->bMargin; - if ($this->rtl) { - $deltacol = $this->x + $this->rMargin - $this->w; - } else { - $deltacol = $this->x - $this->lMargin; - } - } elseif ($column == $endcolumn) { // end column - $cborder = $border_end; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $endy - $this->y; - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } elseif ($page == $startpage) { // first page - $deltacol = 0; - $deltath = 0; - for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column - $this->selectColumn($column); - if ($column == $startcolumn) { // first column - $cborder = $border_start; - $this->y = $starty; - $this->x = $x; - $h = $this->h - $this->y - $this->bMargin; - if ($this->rtl) { - $deltacol = $this->x + $this->rMargin - $this->w; - } else { - $deltacol = $this->x - $this->lMargin; - } - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } elseif ($page == $endpage) { // last page - $deltacol = 0; - $deltath = 0; - for ($column = 0; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); - if ($column == $endcolumn) { // end column - $cborder = $border_end; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $endy - $this->y; - } else { // middle column - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - } - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column - } else { // middle page - $deltacol = 0; - $deltath = 0; - for ($column = 0; $column < $this->num_columns; ++$column) { // for each column - $this->selectColumn($column); - $cborder = $border_middle; - if (isset($this->columns[$column]['th']['\''.$page.'\''])) { - $this->y = $this->columns[$column]['th']['\''.$page.'\'']; - } - $this->x += $deltacol; - $h = $this->h - $this->y - $this->bMargin; - $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; - } // end for each column + } + $prevtrkey = $trkey; + $table_el = $dom[($dom[$key]['parent'])]; + } + // for each row + if (count($table_el['trids']) > 0) { + unset($xmax); + } + foreach ($table_el['trids'] as $j => $trkey) { + $parent = $dom[$trkey]; + if (!isset($xmax)) { + $xmax = $parent['cellpos'][(count($parent['cellpos']) - 1)]['endx']; + } + // for each cell on the row + foreach ($parent['cellpos'] as $k => $cellpos) { + if (isset($cellpos['rowspanid']) AND ($cellpos['rowspanid'] >= 0)) { + $cellpos['startx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['startx']; + $cellpos['endx'] = $table_el['rowspans'][($cellpos['rowspanid'])]['endx']; + $endy = $table_el['rowspans'][($cellpos['rowspanid'])]['endy']; + $startpage = $table_el['rowspans'][($cellpos['rowspanid'])]['startpage']; + $endpage = $table_el['rowspans'][($cellpos['rowspanid'])]['endpage']; + $startcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['startcolumn']; + $endcolumn = $table_el['rowspans'][($cellpos['rowspanid'])]['endcolumn']; + } else { + $endy = $parent['endy']; + $startpage = $parent['startpage']; + $endpage = $parent['endpage']; + $startcolumn = $parent['startcolumn']; + $endcolumn = $parent['endcolumn']; } - if (!empty($cborder) OR !empty($fill)) { - $offsetlen = strlen($ccode); - // draw border and fill - if ($this->inxobj) { - // we are inside an XObject template - if (end($this->xobjects[$this->xobjid]['transfmrk']) !== false) { - $pagemarkkey = key($this->xobjects[$this->xobjid]['transfmrk']); - $pagemark = $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey]; - $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey] += $offsetlen; - } else { - $pagemark = $this->xobjects[$this->xobjid]['intmrk']; - $this->xobjects[$this->xobjid]['intmrk'] += $offsetlen; + if ($this->num_columns == 0) { + $this->num_columns = 1; + } + if (isset($cellpos['border'])) { + $border = $cellpos['border']; + } + if (isset($cellpos['bgcolor']) AND ($cellpos['bgcolor']) !== false) { + $this->SetFillColorArray($cellpos['bgcolor']); + $fill = true; + } else { + $fill = false; + } + $x = $cellpos['startx']; + $y = $parent['starty']; + $starty = $y; + $w = abs($cellpos['endx'] - $cellpos['startx']); + // get border modes + $border_start = TCPDF_STATIC::getBorderMode($border, $position='start', $this->opencell); + $border_end = TCPDF_STATIC::getBorderMode($border, $position='end', $this->opencell); + $border_middle = TCPDF_STATIC::getBorderMode($border, $position='middle', $this->opencell); + // design borders around HTML cells. + for ($page = $startpage; $page <= $endpage; ++$page) { // for each page + $ccode = ''; + $this->setPage($page); + if ($this->num_columns < 2) { + // single-column mode + $this->x = $x; + $this->y = $this->tMargin; + } + // account for margin changes + if ($page > $startpage) { + if (($this->rtl) AND ($this->pagedim[$page]['orm'] != $this->pagedim[$startpage]['orm'])) { + $this->x -= ($this->pagedim[$page]['orm'] - $this->pagedim[$startpage]['orm']); + } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm'] != $this->pagedim[$startpage]['olm'])) { + $this->x += ($this->pagedim[$page]['olm'] - $this->pagedim[$startpage]['olm']); } - $pagebuff = $this->xobjects[$this->xobjid]['outdata']; - $pstart = substr($pagebuff, 0, $pagemark); - $pend = substr($pagebuff, $pagemark); - $this->xobjects[$this->xobjid]['outdata'] = $pstart.$ccode.$pend; - } else { + } + if ($startpage == $endpage) { // single page + $deltacol = 0; + $deltath = 0; + for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column + $this->selectColumn($column); + if ($startcolumn == $endcolumn) { // single column + $cborder = $border; + $h = $endy - $parent['starty']; + $this->y = $y; + $this->x = $x; + } elseif ($column == $startcolumn) { // first column + $cborder = $border_start; + $this->y = $starty; + $this->x = $x; + $h = $this->h - $this->y - $this->bMargin; + if ($this->rtl) { + $deltacol = $this->x + $this->rMargin - $this->w; + } else { + $deltacol = $this->x - $this->lMargin; + } + } elseif ($column == $endcolumn) { // end column + $cborder = $border_end; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $endy - $this->y; + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } elseif ($page == $startpage) { // first page + $deltacol = 0; + $deltath = 0; + for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column + $this->selectColumn($column); + if ($column == $startcolumn) { // first column + $cborder = $border_start; + $this->y = $starty; + $this->x = $x; + $h = $this->h - $this->y - $this->bMargin; + if ($this->rtl) { + $deltacol = $this->x + $this->rMargin - $this->w; + } else { + $deltacol = $this->x - $this->lMargin; + } + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } elseif ($page == $endpage) { // last page + $deltacol = 0; + $deltath = 0; + for ($column = 0; $column <= $endcolumn; ++$column) { // for each column + $this->selectColumn($column); + if ($column == $endcolumn) { // end column + $cborder = $border_end; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $endy - $this->y; + } else { // middle column + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + } + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } else { // middle page + $deltacol = 0; + $deltath = 0; + for ($column = 0; $column < $this->num_columns; ++$column) { // for each column + $this->selectColumn($column); + $cborder = $border_middle; + if (isset($this->columns[$column]['th']['\''.$page.'\''])) { + $this->y = $this->columns[$column]['th']['\''.$page.'\'']; + } + $this->x += $deltacol; + $h = $this->h - $this->y - $this->bMargin; + $ccode .= $this->getCellCode($w, $h, '', $cborder, 1, '', $fill, '', 0, true)."\n"; + } // end for each column + } + if (!empty($cborder) OR !empty($fill)) { + $offsetlen = strlen($ccode); // draw border and fill - if (end($this->transfmrk[$this->page]) !== false) { - $pagemarkkey = key($this->transfmrk[$this->page]); - $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; - } elseif ($this->InFooter) { - $pagemark = $this->footerpos[$this->page]; + if ($this->inxobj) { + // we are inside an XObject template + if (end($this->xobjects[$this->xobjid]['transfmrk']) !== false) { + $pagemarkkey = key($this->xobjects[$this->xobjid]['transfmrk']); + $pagemark = $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey]; + $this->xobjects[$this->xobjid]['transfmrk'][$pagemarkkey] += $offsetlen; + } else { + $pagemark = $this->xobjects[$this->xobjid]['intmrk']; + $this->xobjects[$this->xobjid]['intmrk'] += $offsetlen; + } + $pagebuff = $this->xobjects[$this->xobjid]['outdata']; + $pstart = substr($pagebuff, 0, $pagemark); + $pend = substr($pagebuff, $pagemark); + $this->xobjects[$this->xobjid]['outdata'] = $pstart.$ccode.$pend; } else { - $pagemark = $this->intmrk[$this->page]; + // draw border and fill + if (end($this->transfmrk[$this->page]) !== false) { + $pagemarkkey = key($this->transfmrk[$this->page]); + $pagemark = $this->transfmrk[$this->page][$pagemarkkey]; + } elseif ($this->InFooter) { + $pagemark = $this->footerpos[$this->page]; + } else { + $pagemark = $this->intmrk[$this->page]; + } + $pagebuff = $this->getPageBuffer($this->page); + $pstart = substr($pagebuff, 0, $pagemark); + $pend = substr($pagebuff, $pagemark); + $this->setPageBuffer($this->page, $pstart.$ccode.$pend); } - $pagebuff = $this->getPageBuffer($this->page); - $pstart = substr($pagebuff, 0, $pagemark); - $pend = substr($pagebuff, $pagemark); - $this->setPageBuffer($this->page, $pstart.$ccode.$pend); + } + } // end for each page + // restore default border + $border = $default_border; + } // end for each cell on the row + if (isset($table_el['attribute']['cellspacing'])) { + $this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px'); + } elseif (isset($table_el['border-spacing'])) { + $this->y += $table_el['border-spacing']['V']; + } + $this->Ln(0, $cell); + $this->x = $parent['startx']; + if ($endpage > $startpage) { + if (($this->rtl) AND ($this->pagedim[$endpage]['orm'] != $this->pagedim[$startpage]['orm'])) { + $this->x += ($this->pagedim[$endpage]['orm'] - $this->pagedim[$startpage]['orm']); + } elseif ((!$this->rtl) AND ($this->pagedim[$endpage]['olm'] != $this->pagedim[$startpage]['olm'])) { + $this->x += ($this->pagedim[$endpage]['olm'] - $this->pagedim[$startpage]['olm']); + } + } + } + if (!$in_table_head) { // we are not inside a thead section + $this->cell_padding = $table_el['old_cell_padding']; + // reset row height + $this->resetLastH(); + if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { + $plendiff = ($this->pagelen[$this->numpages] - $this->emptypagemrk[$this->numpages]); + if (($plendiff > 0) AND ($plendiff < 60)) { + $pagediff = substr($this->getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff); + if (substr($pagediff, 0, 5) == 'BT /F') { + // the difference is only a font setting + $plendiff = 0; } } - } // end for each page - // restore default border - $border = $default_border; - } // end for each cell on the row - if (isset($table_el['attribute']['cellspacing'])) { - $this->y += $this->getHTMLUnitToUnits($table_el['attribute']['cellspacing'], 1, 'px'); - } elseif (isset($table_el['border-spacing'])) { - $this->y += $table_el['border-spacing']['V']; - } - $this->Ln(0, $cell); - $this->x = $parent['startx']; - if ($endpage > $startpage) { - if (($this->rtl) AND ($this->pagedim[$endpage]['orm'] != $this->pagedim[$startpage]['orm'])) { - $this->x += ($this->pagedim[$endpage]['orm'] - $this->pagedim[$startpage]['orm']); - } elseif ((!$this->rtl) AND ($this->pagedim[$endpage]['olm'] != $this->pagedim[$startpage]['olm'])) { - $this->x += ($this->pagedim[$endpage]['olm'] - $this->pagedim[$startpage]['olm']); - } - } - } - if (!$in_table_head) { // we are not inside a thead section - $this->cell_padding = $table_el['old_cell_padding']; - // reset row height - $this->resetLastH(); - if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { - $plendiff = ($this->pagelen[$this->numpages] - $this->emptypagemrk[$this->numpages]); - if (($plendiff > 0) AND ($plendiff < 60)) { - $pagediff = substr($this->getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff); - if (substr($pagediff, 0, 5) == 'BT /F') { - // the difference is only a font setting - $plendiff = 0; + if ($plendiff == 0) { + // remove last blank page + $this->deletePage($this->numpages); } } - if ($plendiff == 0) { - // remove last blank page - $this->deletePage($this->numpages); + if (isset($this->theadMargins['top'])) { + // restore top margin + $this->tMargin = $this->theadMargins['top']; + } + if (!isset($table_el['attribute']['nested']) OR ($table_el['attribute']['nested'] != 'true')) { + // reset main table header + $this->thead = ''; + $this->theadMargins = array(); + $this->pagedim[$this->page]['tm'] = $this->tMargin; } } - if (isset($this->theadMargins['top'])) { - // restore top margin - $this->tMargin = $this->theadMargins['top']; - } - if (!isset($table_el['attribute']['nested']) OR ($table_el['attribute']['nested'] != 'true')) { - // reset main table header - $this->thead = ''; - $this->theadMargins = array(); - $this->pagedim[$this->page]['tm'] = $this->tMargin; - } + $parent = $table_el; + break; } - $parent = $table_el; - break; - } - case 'a': { - $this->HREF = array(); - break; - } - case 'sup': { - $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); - break; - } - case 'sub': { - $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); - break; - } - case 'div': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'blockquote': { - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; + case 'a': { + $this->HREF = array(); + break; } - --$this->listindentlevel; - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'p': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - case 'pre': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - $this->premode = false; - break; - } - case 'dl': { - --$this->listnum; - if ($this->listnum <= 0) { - $this->listnum = 0; + case 'sup': { + $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent['fontsize']) / $this->k)); + break; + } + case 'sub': { + $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent['fontsize']) / $this->k)); + break; + } + case 'div': { $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - } else { - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; } - $this->resetLastH(); - break; - } - case 'dt': { - $this->lispacer = ''; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'dd': { - $this->lispacer = ''; - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; - } - --$this->listindentlevel; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'ul': - case 'ol': { - --$this->listnum; - $this->lispacer = ''; - if ($this->rtl) { - $this->rMargin -= $this->listindent; - } else { - $this->lMargin -= $this->listindent; - } - --$this->listindentlevel; - if ($this->listnum <= 0) { - $this->listnum = 0; + case 'blockquote': { + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - } else { - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'p': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + break; + } + case 'pre': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + $this->premode = false; + break; + } + case 'dl': { + --$this->listnum; + if ($this->listnum <= 0) { + $this->listnum = 0; + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + } else { + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + } + $this->resetLastH(); + break; + } + case 'dt': { + $this->lispacer = ''; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'dd': { + $this->lispacer = ''; + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'ul': + case 'ol': { + --$this->listnum; + $this->lispacer = ''; + if ($this->rtl) { + $this->rMargin -= $this->listindent; + } else { + $this->lMargin -= $this->listindent; + } + --$this->listindentlevel; + if ($this->listnum <= 0) { + $this->listnum = 0; + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + } else { + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + } + $this->resetLastH(); + break; + } + case 'li': { + $this->lispacer = ''; + $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); + break; + } + case 'h1': + case 'h2': + case 'h3': + case 'h4': + case 'h5': + case 'h6': { + $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); + break; + } + // Form fields (since 4.8.000 - 2009-09-07) + case 'form': { + $this->form_action = ''; + $this->form_enctype = 'application/x-www-form-urlencoded'; + break; + } + default : { + break; } - $this->resetLastH(); - break; - } - case 'li': { - $this->lispacer = ''; - $this->addHTMLVertSpace(0, 0, $cell, false, $lasttag); - break; - } - case 'h1': - case 'h2': - case 'h3': - case 'h4': - case 'h5': - case 'h6': { - $this->addHTMLVertSpace($hbz, $hb, $cell, false, $lasttag); - break; - } - // Form fields (since 4.8.000 - 2009-09-07) - case 'form': { - $this->form_action = ''; - $this->form_enctype = 'application/x-www-form-urlencoded'; - break; - } - default : { - break; - } } // draw border and background (if any) $this->drawHTMLTagBorder($parent, $xmax); @@ -19987,7 +20330,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $lasttag (boolean) set to true when the tag is the last. * @protected */ - protected function addHTMLVertSpace($hbz=0, $hb=0, $cell=false, $firsttag=false, $lasttag=false) { + protected function addHTMLVertSpace($hbz = 0, $hb = 0, $cell = false, $firsttag = false, $lasttag = false) + { if ($firsttag) { $this->Ln(0, $cell); $this->htmlvspace = 0; @@ -20013,7 +20357,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.7.000 (2010-08-03) */ - protected function getBorderStartPosition() { + protected function getBorderStartPosition() + { if ($this->rtl) { $xmax = $this->lMargin; } else { @@ -20029,7 +20374,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.7.000 (2010-08-03) */ - protected function drawHTMLTagBorder($tag, $xmax) { + protected function drawHTMLTagBorder($tag, $xmax) + { if (!isset($tag['borderposition'])) { // nothing to draw return; @@ -20231,7 +20577,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.0.028 (2008-09-26) */ - public function setLIsymbol($symbol='!') { + public function setLIsymbol($symbol = '!') + { // check for custom image symbol if (substr($symbol, 0, 4) == 'img|') { $this->lisymbol = $symbol; @@ -20254,7 +20601,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.000 (2008-10-29) */ - public function SetBooklet($booklet=true, $inner=-1, $outer=-1) { + public function SetBooklet($booklet = true, $inner = -1, $outer = -1) + { $this->booklet = $booklet; if ($inner >= 0) { $this->lMargin = $inner; @@ -20270,7 +20618,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.000 (2008-10-29) */ - protected function swapMargins($reverse=true) { + protected function swapMargins($reverse = true) + { if ($reverse) { // swap left and right margins $mtemp = $this->original_lMargin; @@ -20294,7 +20643,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.001 (2008-10-30) */ - public function setHtmlVSpace($tagvs) { + public function setHtmlVSpace($tagvs) + { $this->tagvspaces = $tagvs; } @@ -20304,7 +20654,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.007 (2008-11-12) */ - public function setListIndentWidth($width) { + public function setListIndentWidth($width) + { return $this->customlistindent = floatval($width); } @@ -20314,7 +20665,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.2.010 (2008-11-14) */ - public function setOpenCell($isopen) { + public function setOpenCell($isopen) + { $this->opencell = $isopen; } @@ -20325,7 +20677,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.4.003 (2008-12-09) */ - public function setHtmlLinksStyle($color=array(0,0,255), $fontstyle='U') { + public function setHtmlLinksStyle($color = array(0,0,255), $fontstyle = 'U') + { $this->htmlLinkColorArray = $color; $this->htmlLinkFontStyle = $fontstyle; } @@ -20340,7 +20693,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.4.004 (2008-12-10) */ - public function getHTMLUnitToUnits($htmlval, $refsize=1, $defaultunit='px', $points=false) { + public function getHTMLUnitToUnits($htmlval, $refsize = 1, $defaultunit = 'px', $points = false) + { $supportedunits = array('%', 'em', 'ex', 'px', 'in', 'cm', 'mm', 'pc', 'pt'); $retval = 0; $value = 0; @@ -20424,7 +20778,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.4.004 (2008-12-10) */ - protected function putHtmlListBullet($listdepth, $listtype='', $size=10) { + protected function putHtmlListBullet($listdepth, $listtype = '', $size = 10) + { if ($this->state != 2) { return; } @@ -20626,7 +20981,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.010 (2008-11-14) */ - protected function getGraphicVars() { + protected function getGraphicVars() + { $grapvars = array( 'FontFamily' => $this->FontFamily, 'FontStyle' => $this->FontStyle, @@ -20687,7 +21043,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.2.010 (2008-11-14) */ - protected function setGraphicVars($gvars, $extended=false) { + protected function setGraphicVars($gvars, $extended = false) + { if ($this->state != 2) { return; } @@ -20751,7 +21108,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Outputs the "save graphics state" operator 'q' * @protected */ - protected function _outSaveGraphicsState() { + protected function _outSaveGraphicsState() + { $this->_out('q'); } @@ -20759,7 +21117,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Outputs the "restore graphics state" operator 'Q' * @protected */ - protected function _outRestoreGraphicsState() { + protected function _outRestoreGraphicsState() + { $this->_out('Q'); } @@ -20769,7 +21128,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setBuffer($data) { + protected function setBuffer($data) + { $this->bufferlen += strlen($data); $this->buffer .= $data; } @@ -20780,7 +21140,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.5.000 (2010-06-22) */ - protected function replaceBuffer($data) { + protected function replaceBuffer($data) + { $this->bufferlen = strlen($data); $this->buffer = $data; } @@ -20791,7 +21152,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function getBuffer() { + protected function getBuffer() + { return $this->buffer; } @@ -20803,7 +21165,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setPageBuffer($page, $data, $append=false) { + protected function setPageBuffer($page, $data, $append = false) + { if ($append) { $this->pages[$page] .= $data; } else { @@ -20823,7 +21186,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function getPageBuffer($page) { + protected function getPageBuffer($page) + { if (isset($this->pages[$page])) { return $this->pages[$page]; } @@ -20838,8 +21202,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setImageBuffer($image, $data) { - if (($data['i'] = array_search($image, $this->imagekeys)) === FALSE) { + protected function setImageBuffer($image, $data) + { + if (($data['i'] = array_search($image, $this->imagekeys)) === false) { $this->imagekeys[$this->numimages] = $image; $data['i'] = $this->numimages; ++$this->numimages; @@ -20856,7 +21221,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function setImageSubBuffer($image, $key, $data) { + protected function setImageSubBuffer($image, $key, $data) + { if (!isset($this->images[$image])) { $this->setImageBuffer($image, array()); } @@ -20870,7 +21236,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2008-12-31) */ - protected function getImageBuffer($image) { + protected function getImageBuffer($image) + { if (isset($this->images[$image])) { return $this->images[$image]; } @@ -20884,7 +21251,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setFontBuffer($font, $data) { + protected function setFontBuffer($font, $data) + { $this->fonts[$font] = $data; if (!in_array($font, $this->fontkeys)) { $this->fontkeys[] = $font; @@ -20903,7 +21271,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function setFontSubBuffer($font, $key, $data) { + protected function setFontSubBuffer($font, $key, $data) + { if (!isset($this->fonts[$font])) { $this->setFontBuffer($font, array()); } @@ -20917,7 +21286,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 4.5.000 (2009-01-02) */ - protected function getFontBuffer($font) { + protected function getFontBuffer($font) + { if (isset($this->fonts[$font])) { return $this->fonts[$font]; } @@ -20932,7 +21302,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.000 (2009-01-02) */ - public function movePage($frompage, $topage) { + public function movePage($frompage, $topage) + { if (($frompage > $this->numpages) OR ($frompage <= $topage)) { return false; } @@ -21076,7 +21447,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $jfrompage = $frompage; $jtopage = $topage; if (preg_match_all('/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $pagenum = intval($pamatch[3][$pk]) + 1; if (($pagenum >= $jtopage) AND ($pagenum < $jfrompage)) { $newpage = ($pagenum + 1); @@ -21103,7 +21474,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.6.004 (2009-04-23) */ - public function deletePage($page) { + public function deletePage($page) + { if (($page < 1) OR ($page > $this->numpages)) { return false; } @@ -21115,7 +21487,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->bordermrk[$page]); unset($this->cntmrk[$page]); foreach ($this->pageobjects[$page] as $oid) { - if (isset($this->offsets[$oid])){ + if (isset($this->offsets[$oid])) { unset($this->offsets[$oid]); } } @@ -21196,7 +21568,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: unset($this->bordermrk[$this->numpages]); unset($this->cntmrk[$this->numpages]); foreach ($this->pageobjects[$this->numpages] as $oid) { - if (isset($this->offsets[$oid])){ + if (isset($this->offsets[$oid])) { unset($this->offsets[$oid]); } } @@ -21264,7 +21636,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // adjust javascript $jpage = $page; if (preg_match_all('/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) { - foreach($pamatch[0] as $pk => $pmatch) { + foreach ($pamatch[0] as $pk => $pmatch) { $pagenum = intval($pamatch[3][$pk]) + 1; if ($pagenum >= $jpage) { $newpage = ($pagenum - 1); @@ -21293,7 +21665,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.015 (2010-04-20) */ - public function copyPage($page=0) { + public function copyPage($page = 0) + { if ($page == 0) { // default value $page = $this->page; @@ -21370,7 +21743,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.5.000 (2009-01-02) * @see addTOCPage(), endTOCPage(), addHTMLTOC() */ - public function addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { + public function addTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0,0,0)) + { $fontsize = $this->FontSizePt; $fontfamily = $this->FontFamily; $fontstyle = $this->FontStyle; @@ -21580,7 +21954,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.001 (2010-05-06) * @see addTOCPage(), endTOCPage(), addTOC() */ - public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0,0,0)) { + public function addHTMLTOC($page = '', $toc_name = 'TOC', $templates = array(), $correct_align = true, $style = '', $color = array(0,0,0)) + { $filler = ' '; $prev_htmlLinkColorArray = $this->htmlLinkColorArray; $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle; @@ -21713,7 +22088,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function startTransaction() { + public function startTransaction() + { if (isset($this->objcopy)) { // remove previous copy $this->commitTransaction(); @@ -21730,7 +22106,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function commitTransaction() { + public function commitTransaction() + { if (isset($this->objcopy)) { $this->objcopy->_destroy(true, true); unset($this->objcopy); @@ -21744,7 +22121,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.5.029 (2009-03-19) */ - public function rollbackTransaction($self=false) { + public function rollbackTransaction($self = false) + { if (isset($this->objcopy)) { $this->_destroy(true, true); if ($self) { @@ -21768,7 +22146,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function setEqualColumns($numcols=0, $width=0, $y='') { + public function setEqualColumns($numcols = 0, $width = 0, $y = '') + { $this->columns = array(); if ($numcols < 2) { $numcols = 0; @@ -21800,7 +22179,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.072 (2011-04-26) */ - public function resetColumns() { + public function resetColumns() + { $this->lMargin = $this->original_lMargin; $this->rMargin = $this->original_rMargin; $this->setEqualColumns(); @@ -21813,7 +22193,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function setColumnsArray($columns) { + public function setColumnsArray($columns) + { $this->columns = $columns; $this->num_columns = count($columns); $this->current_column = 0; @@ -21827,7 +22208,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.001 (2010-03-28) */ - public function selectColumn($col='') { + public function selectColumn($col = '') + { if (is_string($col)) { $col = $this->current_column; } elseif ($col >= $this->num_columns) { @@ -21906,7 +22288,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.5.011 (2010-07-08) */ - public function getColumn() { + public function getColumn() + { return $this->current_column; } @@ -21916,7 +22299,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.018 (2010-08-25) */ - public function getNumberOfColumns() { + public function getNumberOfColumns() + { return $this->num_columns; } @@ -21928,7 +22312,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 4.9.008 (2009-04-02) */ - public function setTextRenderingMode($stroke=0, $fill=true, $clip=false) { + public function setTextRenderingMode($stroke = 0, $fill = true, $clip = false) + { // Ref.: PDF 32000-1:2008 - 9.3.6 Text Rendering Mode // convert text rendering parameters if ($stroke < 0) { @@ -21983,7 +22368,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.174 (2012-07-25) * @public */ - public function setTextShadow($params=array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal')) { + public function setTextShadow($params = array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal')) + { if (isset($params['enabled'])) { $this->txtshadow['enabled'] = $params['enabled']?true:false; } else { @@ -22025,7 +22411,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.174 (2012-07-25) * @public */ - public function getTextShadow() { + public function getTextShadow() + { return $this->txtshadow; } @@ -22043,7 +22430,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.9.012 (2010-04-12) * @protected */ - protected function hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) { + protected function hyphenateWord($word, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) + { $hyphenword = array(); // hyphens positions $numchars = count($word); if ($numchars <= $charmin) { @@ -22123,7 +22511,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 4.9.012 (2010-04-12) * @public */ - public function hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) { + public function hyphenateText($text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8) + { $text = $this->unhtmlentities($text); $word = array(); // last word $txtarr = array(); // text to be returned @@ -22187,7 +22576,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.0.000 (2010-04-27) */ - public function setRasterizeVectorImages($mode) { + public function setRasterizeVectorImages($mode) + { $this->rasterize_vector_images = $mode; } @@ -22198,7 +22588,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.3.002 (2010-06-07) */ - public function setFontSubsetting($enable=true) { + public function setFontSubsetting($enable = true) + { if ($this->pdfa_mode) { $this->font_subsetting = false; } else { @@ -22213,7 +22604,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.3.002 (2010-06-07) */ - public function getFontSubsetting() { + public function getFontSubsetting() + { return $this->font_subsetting; } @@ -22226,7 +22618,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringLeftTrim($str, $replace='') { + public function stringLeftTrim($str, $replace = '') + { return preg_replace('/^'.$this->re_space['p'].'+/'.$this->re_space['m'], $replace, $str); } @@ -22239,7 +22632,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringRightTrim($str, $replace='') { + public function stringRightTrim($str, $replace = '') + { return preg_replace('/'.$this->re_space['p'].'+$/'.$this->re_space['m'], $replace, $str); } @@ -22252,7 +22646,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.000 (2010-08-11) */ - public function stringTrim($str, $replace='') { + public function stringTrim($str, $replace = '') + { $str = $this->stringLeftTrim($str, $replace); $str = $this->stringRightTrim($str, $replace); return $str; @@ -22265,7 +22660,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.002 (2010-08-14) */ - public function isUnicodeFont() { + public function isUnicodeFont() + { return (($this->CurrentFont['type'] == 'TrueTypeUnicode') OR ($this->CurrentFont['type'] == 'cidfont0')); } @@ -22277,7 +22673,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.8.004 (2010-08-17) */ - public function getFontFamilyName($fontfamily) { + public function getFontFamilyName($fontfamily) + { // remove spaces and symbols $fontfamily = preg_replace('/[^a-z0-9_\,]/', '', strtolower($fontfamily)); // extract all font names @@ -22321,7 +22718,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see endTemplate(), printTemplate() */ - public function startTemplate($w=0, $h=0, $group=false) { + public function startTemplate($w = 0, $h = 0, $group = false) + { if ($this->inxobj) { // we are already inside an XObject template return false; @@ -22386,7 +22784,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see startTemplate(), printTemplate() */ - public function endTemplate() { + public function endTemplate() + { if (!$this->inxobj) { // we are not inside a template return false; @@ -22415,7 +22814,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.8.017 (2010-08-24) * @see startTemplate(), endTemplate() */ - public function printTemplate($id, $x='', $y='', $w=0, $h=0, $align='', $palign='', $fitonpage=false) { + public function printTemplate($id, $x = '', $y = '', $w = 0, $h = 0, $align = '', $palign = '', $fitonpage = false) + { if ($this->state != 2) { return; } @@ -22515,7 +22915,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T': { $this->y = $y; $this->x = $rb_x; @@ -22548,7 +22948,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function setFontStretching($perc=100) { + public function setFontStretching($perc = 100) + { $this->font_stretching = $perc; } @@ -22559,7 +22960,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function getFontStretching() { + public function getFontStretching() + { return $this->font_stretching; } @@ -22570,7 +22972,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function setFontSpacing($spacing=0) { + public function setFontSpacing($spacing = 0) + { $this->font_spacing = $spacing; } @@ -22581,7 +22984,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @public * @since 5.9.000 (2010-09-29) */ - public function getFontSpacing() { + public function getFontSpacing() + { return $this->font_spacing; } @@ -22593,7 +22997,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), addPageRegion() */ - public function getPageRegions() { + public function getPageRegions() + { return $this->page_regions; } @@ -22608,7 +23013,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see addPageRegion(), getPageRegions() */ - public function setPageRegions($regions=array()) { + public function setPageRegions($regions = array()) + { // empty current regions array $this->page_regions = array(); // add regions @@ -22628,7 +23034,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), getPageRegions() */ - public function addPageRegion($region) { + public function addPageRegion($region) + { if (!isset($region['page']) OR empty($region['page'])) { $region['page'] = $this->page; } @@ -22647,7 +23054,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.9.003 (2010-10-13) * @see setPageRegions(), getPageRegions() */ - public function removePageRegion($key) { + public function removePageRegion($key) + { if (isset($this->page_regions[$key])) { unset($this->page_regions[$key]); } @@ -22665,7 +23073,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.9.003 (2010-10-13) */ - protected function checkPageRegions($h, $x, $y) { + protected function checkPageRegions($h, $x, $y) + { // set default values if ($x === '') { $x = $this->x; @@ -22768,7 +23177,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @public */ - public function ImageSVG($file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false) { + public function ImageSVG($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false) + { if ($this->state != 2) { return; } @@ -22794,7 +23204,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svgdir = dirname($file); $svgdata = TCPDF_STATIC::fileGetContents($file); } - if ($svgdata === FALSE) { + if ($svgdata === false) { $this->Error('SVG file not found: '.$file); } if ($x === '') { @@ -23039,7 +23449,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->Link($ximg, $y, $w, $h, $link, 0); } // set pointer to align the next text/objects - switch($align) { + switch ($align) { case 'T':{ $this->y = $y; $this->x = $this->img_rb_x; @@ -23089,7 +23499,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.0.000 (2010-05-02) */ - protected function convertSVGtMatrix($tm) { + protected function convertSVGtMatrix($tm) + { $a = $tm[0]; $b = -$tm[1]; $c = -$tm[2]; @@ -23109,7 +23520,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @protected * @since 5.0.000 (2010-05-02) */ - protected function SVGTransform($tm) { + protected function SVGTransform($tm) + { $this->Transform($this->convertSVGtMatrix($tm)); } @@ -23128,7 +23540,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function='', $clip_params=array()) { + protected function setSVGStyles($svgstyle, $prevsvgstyle, $x = 0, $y = 0, $w = 1, $h = 1, $clip_function = '', $clip_params = array()) + { if ($this->state != 2) { return; } @@ -23243,7 +23656,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $gradient['coords'][3] = (($gradient['coords'][3] - $y) / $h); $gradient['coords'][4] /= $w; } elseif ($gradient['mode'] == 'percentage') { - foreach($gradient['coords'] as $key => $val) { + foreach ($gradient['coords'] as $key => $val) { $gradient['coords'][$key] = (intval($val) / 100); if ($val < 0) { $gradient['coords'][$key] = 0; @@ -23409,21 +23822,22 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * Draws an SVG path * @param $d (string) attribute d of the path SVG element * @param $style (string) Style of rendering. Possible values are: - *
        - *
      • D or empty string: Draw (default).
      • - *
      • F: Fill.
      • - *
      • F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
      • - *
      • DF or FD: Draw and fill.
      • - *
      • DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
      • - *
      • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
      • - *
      • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
      • - *
      + *
        + *
      • D or empty string: Draw (default).
      • + *
      • F: Fill.
      • + *
      • F*: Fill using the even-odd rule to determine which regions lie inside the clipping path.
      • + *
      • DF or FD: Draw and fill.
      • + *
      • DF* or FD*: Draw and fill using the even-odd rule to determine which regions lie inside the clipping path.
      • + *
      • CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).
      • + *
      • CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).
      • + *
      * @return array of container box measures (x, y, w, h) * @author Nicola Asuni * @since 5.0.000 (2010-05-02) * @protected */ - protected function SVGPath($d, $style='') { + protected function SVGPath($d, $style = '') + { if ($this->state != 2) { return; } @@ -23714,7 +24128,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { $root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2))); } - if ($fa == $fs){ + if ($fa == $fs) { $root *= -1; } $cax = $root * (($rx * $ya) / $ry); @@ -23780,8 +24194,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $name (string) Tag name * @protected */ - protected function removeTagNamespace($name) { - if(strpos($name, ':') !== false) { + protected function removeTagNamespace($name) + { + if (strpos($name, ':') !== false) { $parts = explode(':', $name); return $parts[(sizeof($parts) - 1)]; } @@ -23798,7 +24213,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array()) { + protected function startSVGElementHandler($parser, $name, $attribs, $ctm = array()) + { $name = $this->removeTagNamespace($name); // check if we are in clip mode if ($this->svgclipmode) { @@ -23811,7 +24227,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs); return; } - if (end($this->svgdefs) !== FALSE) { + if (end($this->svgdefs) !== false) { $last_svgdefs_id = key($this->svgdefs); if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) { $attribs['id'] = 'DF_'.(count($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements']) + 1); @@ -23827,7 +24243,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $clipping = true; } // get styling properties - $prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; // previous style + $prev_svgstyle = $this->svgstyles[max(0, (count($this->svgstyles) - 1))]; // previous style $svgstyle = $this->svgstyles[0]; // set default style if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) { // default fill attribute for clipping @@ -23877,7 +24293,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $invisible = true; } // process tag - switch($name) { + switch ($name) { case 'defs': { $this->svgdefsmode = true; break; @@ -23898,7 +24314,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } case 'svg': { // start of SVG object - if(++$this->svg_tag_depth <= 1) { + if (++$this->svg_tag_depth <= 1) { break; } // inner SVG @@ -23934,7 +24350,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $aspectY = 'YMid'; $fit = 'meet'; if (isset($attribs['preserveAspectRatio'])) { - if($attribs['preserveAspectRatio'] == 'none') { + if ($attribs['preserveAspectRatio'] == 'none') { $fit = 'none'; } else { preg_match_all('/[a-zA-Z]+/', $attribs['preserveAspectRatio'], $tmp); @@ -24430,7 +24846,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } if (!empty($use['attribs']['style'])) { // merge styles - $attribs['style'] = str_replace(';;',';',';'.$use['attribs']['style'].$attribs['style']); + $attribs['style'] = str_replace(';;', ';', ';'.$use['attribs']['style'].$attribs['style']); } $attribs = array_merge($use['attribs'], $attribs); $this->startSVGElementHandler($parser, $use['name'], $attribs); @@ -24447,7 +24863,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (!empty($attribs['child_elements'])) { $child_elements = $attribs['child_elements']; unset($attribs['child_elements']); - foreach($child_elements as $child_element) { + foreach ($child_elements as $child_element) { if (empty($child_element['attribs']['closing_tag'])) { $this->startSVGElementHandler('child-tag', $child_element['name'], $child_element['attribs']); } else { @@ -24468,27 +24884,28 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function endSVGElementHandler($parser, $name) { + protected function endSVGElementHandler($parser, $name) + { $name = $this->removeTagNamespace($name); if ($this->svgdefsmode AND !in_array($name, array('defs', 'clipPath', 'linearGradient', 'radialGradient', 'stop'))) {; - if (end($this->svgdefs) !== FALSE) { + if (end($this->svgdefs) !== false) { $last_svgdefs_id = key($this->svgdefs); if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) { - foreach($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'] as $child_element) { + foreach ($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'] as $child_element) { if (isset($child_element['attribs']['id']) AND ($child_element['name'] == $name)) { - $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$child_element['attribs']['id'].'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE, 'content' => $this->svgtext)); + $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$child_element['attribs']['id'].'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => true, 'content' => $this->svgtext)); return; } } if ($this->svgdefs[$last_svgdefs_id]['name'] == $name) { - $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$last_svgdefs_id.'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => TRUE, 'content' => $this->svgtext)); + $this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$last_svgdefs_id.'_CLOSE'] = array('name' => $name, 'attribs' => array('closing_tag' => true, 'content' => $this->svgtext)); return; } } } return; } - switch($name) { + switch ($name) { case 'defs': { $this->svgdefsmode = false; break; @@ -24575,12 +24992,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @since 5.0.000 (2010-05-02) * @protected */ - protected function segSVGContentHandler($parser, $data) { + protected function segSVGContentHandler($parser, $data) + { $this->svgtext .= $data; } // --- END SVG METHODS ----------------------------------------------------- - } // END OF TCPDF CLASS //============================================================+ diff --git a/htdocs/install/default.css b/htdocs/install/default.css index d18e54c0c1c..e7bbe6c7771 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -32,6 +32,10 @@ vertical-align: middle; } +.right { + text-align: right; +} + .opacitymedium { opacity: 0.5; } diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 7af5d28df8c..a1293084a52 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -302,12 +302,25 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1); -- Mexique -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', 'Sociedad en nombre colectivo', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', 'Sociedad en comandita simple', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', 'Sociedad de responsabilidad limitada', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', 'Sociedad anónima', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', 'Sociedad en comandita por acciones', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', 'Sociedad cooperativa', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); -- Luxembourg INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14001', 'Entreprise individuelle', 1); diff --git a/htdocs/install/mysql/data/llx_c_partnership_type.sql b/htdocs/install/mysql/data/llx_c_partnership_type.sql new file mode 100644 index 00000000000..9410911b374 --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_partnership_type.sql @@ -0,0 +1,27 @@ +-- Copyright (C) 2020 florian HENRY florian.henry@scopen.fr +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- + +-- +-- Do not place a comment at the end of the line, this file is parsed when +-- from the install and all '--' are removed. +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +INSERT INTO llx_c_partnership_type (code, label, active) VALUES ('DEFAULT', 'Default', 1); + diff --git a/htdocs/install/mysql/data/llx_c_socialnetworks.sql b/htdocs/install/mysql/data/llx_c_socialnetworks.sql index 5bfbcf090d9..468086291fc 100644 --- a/htdocs/install/mysql/data/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/data/llx_c_socialnetworks.sql @@ -36,6 +36,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1); diff --git a/htdocs/install/mysql/data/llx_c_ticket_type.sql b/htdocs/install/mysql/data/llx_c_ticket_type.sql index 3b6fda322ad..85a85b0a63d 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_type.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_type.sql @@ -23,4 +23,4 @@ INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, descriptio INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROJECT', '30', 'Project', 0, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 0, NULL); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 1, NULL); diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 7be62695d50..f744abffde4 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -506,3 +506,31 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); + + +-- We do not delete old mexican legal forms because they may have been used. User will have to insert the new one manually not inserted because of conflict if he need them. +--DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); + +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); + +-- VMYSQL4.3 ALTER TABLE llx_user MODIFY COLUMN fk_soc integer NULL; +-- VPGSQL8.2 ALTER TABLE llx_user ALTER COLUMN fk_soc DROP NOT NULL; + diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index b78e53bd287..5d838fc8bb1 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -69,6 +69,26 @@ ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(128); UPDATE llx_rights_def SET perms = 'writeall' WHERE perms = 'writeall_advance' AND module = 'holiday'; +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); + -- v16 @@ -237,4 +257,19 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); + +ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); + +ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation; + +-- Set default ticket type to OTHER if no default exists +UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index aed803cc7ea..d9713b66d38 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -42,6 +42,7 @@ create table llx_bank_account country_iban varchar(2), -- deprecated cle_iban varchar(2), domiciliation varchar(255), + pti_in_ctti smallint DEFAULT 0, state_id integer DEFAULT NULL, fk_pays integer NOT NULL, proprio varchar(60), diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql index b3065fdb5d6..c5a451e030f 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql @@ -16,10 +16,8 @@ -- ============================================================================ -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (ref, entity); -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity); +ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity); -ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_soc (fk_soc); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_user_author (fk_user_author); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_projet (fk_projet); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql new file mode 100644 index 00000000000..ecfd1de723e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql @@ -0,0 +1,21 @@ +-- =================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql new file mode 100644 index 00000000000..f6a6a59e0a1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql @@ -0,0 +1,27 @@ +-- ======================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting + +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_reception.sql b/htdocs/install/mysql/tables/llx_reception.sql index 7989f80cf58..8de59edcb77 100644 --- a/htdocs/install/mysql/tables/llx_reception.sql +++ b/htdocs/install/mysql/tables/llx_reception.sql @@ -26,11 +26,11 @@ create table llx_reception ref varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - fk_projet integer DEFAULT NULL, + fk_projet integer DEFAULT NULL, ref_ext varchar(30), -- reference into an external system (not used by dolibarr) - ref_int varchar(30), -- reference into an internal system (deprecated) - ref_supplier varchar(30), -- customer number + ref_int varchar(30), -- reference into an internal system (deprecated) + ref_supplier varchar(128), -- supplier number date_creation datetime, -- date de creation fk_user_author integer, -- author of creation @@ -38,7 +38,7 @@ create table llx_reception date_valid datetime, -- date de validation fk_user_valid integer, -- valideur date_delivery datetime DEFAULT NULL, -- date planned of delivery - date_reception datetime, + date_reception datetime, fk_shipping_method integer, tracking_number varchar(50), fk_statut smallint DEFAULT 0, -- 0 = draft, 1 = validated, 2 = billed or closed depending on WORKFLOW_BILL_ON_SHIPMENT option diff --git a/htdocs/install/mysql/tables/llx_ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.key.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql diff --git a/htdocs/install/mysql/tables/llx_user.key.sql b/htdocs/install/mysql/tables/llx_user.key.sql index 047a10f1e90..f2250ccea75 100644 --- a/htdocs/install/mysql/tables/llx_user.key.sql +++ b/htdocs/install/mysql/tables/llx_user.key.sql @@ -21,7 +21,7 @@ ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity); -ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc); +ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member); diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 8aa0d381e26..6cfdf8bfbb8 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -64,12 +64,12 @@ create table llx_user --module_comm smallint DEFAULT 1, --module_compta smallint DEFAULT 1, - fk_soc integer, -- id thirdparty if user linked to a company (external user) - fk_socpeople integer, -- id contact origin if user linked to a contact - fk_member integer, -- if member if suer linked to a member - fk_user integer, -- Supervisor, hierarchic parent - fk_user_expense_validator integer, - fk_user_holiday_validator integer, + fk_soc integer NULL, -- id thirdparty if user linked to a company (external user) + fk_socpeople integer NULL, -- id contact origin if user linked to a contact + fk_member integer NULL, -- if member if suer linked to a member + fk_user integer NULL, -- Supervisor, hierarchic parent + fk_user_expense_validator integer NULL, + fk_user_holiday_validator integer NULL, idpers1 varchar(128), idpers2 varchar(128), diff --git a/htdocs/install/mysql/tables/llx_website.key.sql b/htdocs/install/mysql/tables/llx_website-website.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website.key.sql rename to htdocs/install/mysql/tables/llx_website-website.key.sql diff --git a/htdocs/install/mysql/tables/llx_website_extrafields.key.sql b/htdocs/install/mysql/tables/llx_website_extrafields-website.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_website_extrafields-website.key.sql diff --git a/htdocs/install/mysql/tables/llx_website_extrafields.sql b/htdocs/install/mysql/tables/llx_website_extrafields-website.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website_extrafields.sql rename to htdocs/install/mysql/tables/llx_website_extrafields-website.sql diff --git a/htdocs/install/mysql/tables/llx_website_page.key.sql b/htdocs/install/mysql/tables/llx_website_page-website.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website_page.key.sql rename to htdocs/install/mysql/tables/llx_website_page-website.key.sql diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page-website.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website_page.sql rename to htdocs/install/mysql/tables/llx_website_page-website.sql diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index e58ae528f97..25dd1ee84fd 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -235,8 +235,12 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Force l'affichage de la progression if ($ok) { - print '
    '; + print ''; + print '
    '.$langs->trans("PleaseBePatient").'
    '.$langs->trans("PleaseBePatient").'
    '; + flush(); + + print ''; } @@ -355,7 +359,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Scan if there is migration scripts that depends of Dolibarr version - // for modules htdocs/module/sql or htdocs/custom/module/sql (files called "dolibarr_x.y.z-a.b.c.sql") + // for modules htdocs/module/sql or htdocs/custom/module/sql (files called "dolibarr_x.y.z-a.b.c.sql" or "dolibarr_always.sql") $modulesfile = array(); foreach ($conf->file->dol_document_root as $type => $dirroot) { $handlemodule = @opendir($dirroot); // $dirroot may be '..' @@ -366,6 +370,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (is_file($dirroot.'/'.$filemodule.'/sql/dolibarr_'.$file)) { $modulesfile[$dirroot.'/'.$filemodule.'/sql/dolibarr_'.$file] = '/'.$filemodule.'/sql/dolibarr_'.$file; } + if (is_file($dirroot.'/'.$filemodule.'/sql/dolibarr_allversions.sql')) { + $modulesfile[$dirroot.'/'.$filemodule.'/sql/dolibarr_allversions.sql'] = '/'.$filemodule.'/sql/dolibarr_allversions.sql'; + } } } closedir($handlemodule); @@ -398,6 +405,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } } + if (empty($actiondone)) { print '
    '.$langs->trans("ErrorWrongParameters").'
    '; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 9be3cc361a0..924d251702c 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -456,6 +456,13 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ migrate_export_import_profiles('export'); migrate_export_import_profiles('import'); } + + // Scripts for 16.0 + $afterversionarray = explode('.', '15.0.9'); + $beforeversionarray = explode('.', '16.0.9'); + if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + migrate_user_photospath2(); + } } @@ -4505,8 +4512,7 @@ function migrate_user_photospath() } // dol_delete_dir($origin.'/'.$file); } - } else // it is a file - { + } else { // it is a file if (!dol_is_file($destin.'/'.$file)) { //print $origin.'/'.$file.' -> '.$destin.'/'.$file.'
    '."\n"; print '.'; @@ -4524,6 +4530,94 @@ function migrate_user_photospath() print ''; } +/** + * Migrate file from old path users/99/file.jpg into users/99/photos/file.jpg + * + * @return void + */ +function migrate_user_photospath2() +{ + global $conf, $db, $langs, $user; + + print ''; +} + /* A faire egalement: Modif statut paye et fk_facture des factures payes completement diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 2fcf05a4393..91f127b0057 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -184,9 +184,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '; + + print ''.$langs->trans('MigrationUserPhotoPath')."
    \n"; + + include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $fuser = new User($db); + + if (!is_object($user)) { + $user = $fuser; // To avoid error during migration + } + + $sql = "SELECT rowid as uid from ".MAIN_DB_PREFIX."user"; // Get list of all users + $resql = $db->query($sql); + if ($resql) { + while ($obj = $db->fetch_object($resql)) { + $fuser->fetch($obj->uid); + //echo '
    '.$fuser->id.' -> '.$fuser->entity; + $entity = (empty($fuser->entity) ? 1 : $fuser->entity); + if ($entity > 1) { + $dir = DOL_DATA_ROOT.'/'.$entity.'/users'; + } else { + $dir = $conf->user->multidir_output[$entity]; // $conf->user->multidir_output[] for each entity is construct by the multicompany module + } + + if ($dir) { + //print "Process user id ".$fuser->id."
    \n"; + $origin = $dir.'/'.$fuser->id; + $destin = $dir.'/'.$fuser->id.'/photos'; + + $origin_osencoded = dol_osencode($origin); + + dol_mkdir($destin); + + //echo '
    '.$origin.' -> '.$destin; + if (dol_is_dir($origin)) { + $handle = opendir($origin_osencoded); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if ($file == '.' || $file == '..' || $file == 'photos') { + continue; + } + if (!empty($fuser->photo) && ($file != $fuser->photo && $file != 'thumbs')) { + continue; + } + + if (dol_is_dir($origin.'/'.$file)) { // it is a dir (like 'thumbs') + $thumbs = opendir($origin_osencoded.'/'.$file); + if (is_resource($thumbs)) { + dol_mkdir($destin.'/'.$file); + while (($thumb = readdir($thumbs)) !== false) { + if (!dol_is_file($destin.'/'.$file.'/'.$thumb)) { + if ($thumb == '.' || $thumb == '..') { + continue; + } + + //print $origin.'/'.$file.'/'.$thumb.' -> '.$destin.'/'.$file.'/'.$thumb.'
    '."\n"; + print '.'; + dol_copy($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb, 0, 0); + } + } + // dol_delete_dir($origin.'/'.$file); + } + } else { // it is a file + if (!dol_is_file($destin.'/'.$file)) { + //print $origin.'/'.$file.' -> '.$destin.'/'.$file.'
    '."\n"; + print '.'; + dol_copy($origin.'/'.$file, $destin.'/'.$file, 0, 0); + } + } + } + } + } + } + } + } + + print '
    '."\n"; // Common attributes diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index aed45b1db26..675f6e4397f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; // for other modules +if (!empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +} //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page @@ -51,6 +54,13 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $id = GETPOST('id', 'int'); +$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array'); +$searchCategoryKnowledgemanagementOperator = 0; +if (GETPOSTISSET('formfilteraction')) { + $searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int'); +} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { + $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; +} // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -186,6 +196,10 @@ if (empty($reshook)) { || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $searchCategoryKnowledgemanagementOperator = 0; + $searchCategoryKnowledgemanagementList = array(); + } // Mass actions $objectclass = 'KnowledgeRecord'; @@ -229,9 +243,12 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', ',', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } +if (!empty($searchCategoryKnowledgemanagementList) || !empty($catid)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_knowledgemanagement as ck ON t.rowid = ck.fk_knowledgemanagement"; // We'll need this table joined to the select in order to filter by categ +} // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -270,6 +287,32 @@ foreach ($search as $key => $val) { } } } +//Search for tag/category +$searchCategoryKnowledgemanagementSqlList = array(); +if ($searchCategoryKnowledgemanagementOperator == 1) { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie = ".$db->escape($searchCategoryKnowledgemanagement); + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} else { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "t.rowid IN (SELECT fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")"; + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} + if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -379,6 +422,11 @@ $arrayofmassactions = array( if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + +if ($user->rights->knowledgemanagement->knowledgerecord->write) { + $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); +} + if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } @@ -418,6 +466,18 @@ $moreforfilter = ''; $moreforfilter.= $langs->trans('MyFilter') . ': '; $moreforfilter.= '';*/ +// Filter on categories +$moreforfilter = ''; +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + $moreforfilter .= '
    '; + $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"'); + $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1); + $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -'; + $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300'); + $moreforfilter .= ' '; + $moreforfilter .= '
    '; +} + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook if (empty($reshook)) { @@ -547,6 +607,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print ''; + $totalarray['nbfield'] = 0; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8bc4b54a090..a44c819aa78 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -62,24 +62,24 @@ MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscrip AccountancyArea=Accounting area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year... -AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making the journalization (writing record in Journals and General ledger) +AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you automaticaly the correct default accounting account when transferring data in accounting AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... -AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s +AccountancyAreaDescJournalSetup=STEP %s: Check content of your journal list from menu %s AccountancyAreaDescChartModel=STEP %s: Check that a model of chart of account exists or create one from menu %s AccountancyAreaDescChart=STEP %s: Select and|or complete your chart of account from menu %s AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. -AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. +AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of Expense report. For this, use the menu entry %s. AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. -AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expenses (miscellaneous taxes). For this, use the menu entry %s. +AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for Taxes (special expenses). For this, use the menu entry %s. AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s. AccountancyAreaDescSubscription=STEP %s: Define default accounting accounts for member subscription. For this, use the menu entry %s. AccountancyAreaDescMisc=STEP %s: Define mandatory default account and default accounting accounts for miscellaneous transactions. For this, use the menu entry %s. AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s. AccountancyAreaDescBank=STEP %s: Define accounting accounts and journal code for each bank and financial accounts. For this, use the menu entry %s. -AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s. +AccountancyAreaDescProd=STEP %s: Define accounting accounts on your Products/Services. For this, use the menu entry %s. AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s. AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the Ledger. For this, go into menu %s, and click into button %s. @@ -112,7 +112,7 @@ MenuAccountancyClosure=Closure MenuAccountancyValidationMovements=Validate movements ProductsBinding=Products accounts TransferInAccounting=Transfer in accounting -RegistrationInAccounting=Registration in accounting +RegistrationInAccounting=Recording in accounting Binding=Binding to accounts CustomersVentilation=Customer invoice binding SuppliersVentilation=Vendor invoice binding @@ -120,7 +120,7 @@ ExpenseReportsVentilation=Expense report binding CreateMvts=Create new transaction UpdateMvts=Modification of a transaction ValidTransaction=Validate transaction -WriteBookKeeping=Register transactions in accounting +WriteBookKeeping=Record transactions in accounting Bookkeeping=Ledger BookkeepingSubAccount=Subledger AccountBalance=Account balance @@ -294,7 +294,7 @@ Balancing=Balancing FicheVentilation=Binding card GeneralLedgerIsWritten=Transactions are written in the Ledger GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be journalized. If there is no other error message, this is probably because they were already journalized. -NoNewRecordSaved=No more record to journalize +NoNewRecordSaved=No more record to transfer ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account ChangeBinding=Change the binding Accounted=Accounted in ledger diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cd90541f889..cffd3532c05 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1188,7 +1188,7 @@ BankModuleNotActive=Bank accounts module not enabled ShowBugTrackLink=Show the link "%s" ShowBugTrackLinkDesc=Keep empty to not display this link, use value 'github' for the link to the Dolibarr project or define directly an url 'https://...' Alerts=Alerts -DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for: +DelaysOfToleranceBeforeWarning=Displaying a warning alert for... DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element. Delays_MAIN_DELAY_ACTIONS_TODO=Planned events (agenda events) not completed Delays_MAIN_DELAY_PROJECT_TO_CLOSE=Project not closed in time @@ -2222,3 +2222,6 @@ API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first PreviousHash=Previous hash +LateWarningAfter="Late" warning after +TemplateforBusinessCards=Template for a business card in different size +InventorySetup= Inventory Setup diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index f066877f676..959db0f1a5f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -182,3 +182,6 @@ IfYouDontReconcileDisableProperty=If you don't make the bank reconciliations on NoBankAccountDefined=No bank account defined NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled. AlreadyOneBankAccount=Already one bank account defined +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=SEPA XML: PaymentTypeInformation is mandatory and can now be placed at CreditTransferTransactionInformation level (instead of Payment level). We strongly recommend to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. +ToCreateRelatedRecordIntoBank=To create missing related bank record diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 710d49bfab6..2ace1eb97e1 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -23,7 +23,7 @@ BoxLastMembersSubscriptions=Latest member subscriptions BoxFicheInter=Latest interventions BoxCurrentAccounts=Open accounts balance BoxTitleMemberNextBirthdays=Birthdays of this month (members) -BoxTitleMembersByType=Members by type +BoxTitleMembersByType=Members by type and status BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastProducts=Products/Services: last %s modified diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 98d83aa9453..7ab5d41f285 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -67,7 +67,7 @@ ErrorDestinationAlreadyExists=Another file with the name %s already exist ErrorPartialFile=File not received completely by server. ErrorNoTmpDir=Temporary directy %s does not exists. ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin. -ErrorFileSizeTooLarge=File size is too large. +ErrorFileSizeTooLarge=File size is too large or file not provided. ErrorFieldTooLong=Field %s is too long. ErrorSizeTooLongForIntType=Size too long for int type (%s digits maximum) ErrorSizeTooLongForVarcharType=Size too long for string type (%s chars maximum) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index c571ec6ca8a..ab3628026c5 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -79,3 +79,6 @@ NoEval=No evaluation done for this employee HowManyUserWithThisMaxNote=Number of users with this rank HighestRank=Highest rank SkillComparison=Skill comparison +ActionsOnJob=Events on this job +VacantPosition=job vacancy +VacantCheckboxHelper=Checking this option will show unfilled positions (job vacancy) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2d850927782..62d167ea233 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -517,6 +517,7 @@ or=or Other=Other Others=Others OtherInformations=Other information +Workflow=Workflow Quantity=Quantity Qty=Qty ChangedBy=Changed by @@ -1164,3 +1165,5 @@ NotClosedYet=Not yet closed ClearSignature=Reset signature CanceledHidden=Canceled hidden CanceledShown=Canceled shown +Terminate=Terminate +Terminated=Terminated diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 9605e7a8df7..8646c40b98f 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -159,7 +159,7 @@ HTPasswordExport=htpassword file generation NoThirdPartyAssociatedToMember=No third party associated with this member MembersAndSubscriptions=Members and Contributions MoreActions=Complementary action on recording -MoreActionsOnSubscription=Complementary action, suggested by default when recording a contribution +MoreActionsOnSubscription=Complementary action suggested by default when recording a contribution, also done automatially on online payment of a contribution MoreActionBankDirect=Create a direct entry on bank account MoreActionBankViaInvoice=Create an invoice, and a payment on bank account MoreActionInvoiceOnly=Create an invoice with no payment diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 74bed0d9186..4dc74122ea9 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -107,3 +107,6 @@ THMEstimatedHelp=This rate makes it possible to define a forecast cost of the it BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines +BOMNetNeeds=Net Needs +TreeStructure=Tree structure +GroupByProduct=Group by product \ No newline at end of file diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index dd1e0ea4027..4bd64f44577 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -42,4 +42,5 @@ HideLots=Hide lots #Traceability - qc status OutOfOrder=Out of order InWorkingOrder=In working order -ToReplace=Replace \ No newline at end of file +ToReplace=Replace +CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 14715670882..960bf02eb46 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -411,3 +411,4 @@ Rank=Rank SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) +InventoryExtraFields= Extra Fields (inventory) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index d38358eb74d..9dfc4874cc5 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,6 +136,13 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. +TicketsAutoReadTicket=Automatically mark the ticket as read (when created from backoffice) +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. When ticket is create from the public interface, ticket remains with the status "Not Read". +TicketsDelayBeforeFirstAnswer=A new ticket should receive a first answer before (hours): +TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view. +TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours): +TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received an answer has not had further interaction after this time period (in hours), a warning icon will be displayed in the list view. + # # Index & list page # @@ -241,6 +248,8 @@ TicketNotNotifyTiersAtCreate=Not notify company at create Unread=Unread TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface. ErrorTicketRefRequired=Ticket reference name is required +TicketsDelayForFirstResponseTooLong=Too much time elapsed since ticket opening without any answer. +TicketsDelayFromLastResponseTooLong=Too much time elapsed since last answer on this ticket. # # Logs diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index d47596fe95e..dca9ca4deb6 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -79,3 +79,6 @@ NoEval=Aucune évaluation effectuée pour cet employé HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau HighestRank=Plus haut niveau SkillComparison=Comparaison des compétences +ActionsOnJob=Événements sur cet emploi +VacantPosition=Poste vacant +VacantCheckboxHelper=Cocher cette option affichera le(s) poste(s) comme non pourvu(s) diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 63c5192a01f..12778f337dd 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -517,6 +517,7 @@ or=ou Other=Autre Others=Autres OtherInformations=Autre information +Workflow=Processus de travail Quantity=Quantité Qty=Qté ChangedBy=Modifié par diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index e1883f5bba0..68b5e928084 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -43,3 +43,4 @@ HideLots=Masquer les lots OutOfOrder=Hors d'usage InWorkingOrder=En état de marche ToReplace=Remplacer +CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui n’existe plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre. diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 91850194533..bc51a7627fd 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Envoyer un ou des emails lorsqu’un nouveau TicketsPublicNotificationNewMessageHelp=Envoyer un (des) courriel(s) lorsqu’un nouveau message est ajouté à partir de l’interface publique (à l’utilisateur désigné ou au courriel de notification (mise à jour) et/ou au courriel de notification) TicketPublicNotificationNewMessageDefaultEmail=Emails de notifications à (mise à jour) TicketPublicNotificationNewMessageDefaultEmailHelp=Envoyez un email à cette adresse email pour chaque nouveau message de notifications si le ticket n'a pas d'utilisateur assigné ou si l'utilisateur n'a pas d'email connu. +TicketsAutoReadTicket=Automatiquement marquer le ticket comme lu +TicketsAutoReadTicketHelp=Automatiquement marquer le ticket comme lu s'il est créé depuis le backoffice. + # # Index & list page # diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 88701e35166..4bc539c1ff0 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -618,6 +618,11 @@ if ($id > 0) { } print ''; + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
    '; print ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 303ed94576e..55aa799ed90 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -97,15 +97,15 @@ function testSqlAndScriptInject($val, $type) //$val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $val); // Sometimes we have entities without the ; at end so html_entity_decode does not work but entities is still interpreted by browser. $val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { return realCharForNumericEntities($m); }, $val); + + // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) + // We should use dol_string_nounprintableascii but function is not yet loaded/available + $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace + // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) + $val = preg_replace('//', '', $val); } while ($oldval != $val); //print "after decoding $val\n"; - // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) - // We should use dol_string_nounprintableascii but function is not yet loaded/available - $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace - // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) - $val = preg_replace('//', '', $val); - $inj = 0; // For SQL Injection (only GET are used to scan for such injection strings) if ($type == 1 || $type == 3) { @@ -149,7 +149,7 @@ function testSqlAndScriptInject($val, $type) // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $val); - $inj += preg_match('/on(dblclick|drop|durationchange|emptied|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val); + $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $val); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val); @@ -158,8 +158,8 @@ function testSqlAndScriptInject($val, $type) $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like - $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); - $inj += preg_match('/on(dblclick|drop|durationchange|emptied|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); + $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); + $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval); @@ -282,7 +282,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') { // Init session. Name of session is specific to Dolibarr instance. // Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https). -// Note: the function dol_getprefix is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. +// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. $prefix = dol_getprefix(''); $sessionname = 'DOLSESSID_'.$prefix; $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; @@ -290,7 +290,6 @@ if (!empty($_COOKIE[$sessiontimeout])) { ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); } - // This create lock, released by session_write_close() or end of page. // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. if (!defined('NOSESSION')) { @@ -504,7 +503,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( // If token is not provided or empty, error (we are in case it is mandatory) if (!GETPOST('token', 'alpha') || GETPOST('token', 'alpha') == 'notrequired') { if (GETPOST('uploadform', 'int')) { - dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused. File size too large."); + dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused. File size too large or not provided."); $langs->loadLangs(array("errors", "install")); print $langs->trans("ErrorFileSizeTooLarge").' '; print $langs->trans("ErrorGoBackAndCorrectParameters"); @@ -534,7 +533,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings'); - if (isset($_POST['id'])) $savid = ((int) $_POST['id']); + $savid = null; + if (isset($_POST['id'])) { + $savid = ((int) $_POST['id']); + } unset($_POST); //unset($_POST['action']); unset($_POST['massaction']); //unset($_POST['confirm']); unset($_POST['confirmmassaction']); @@ -542,7 +544,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( unset($_GET['action']); unset($_GET['confirmmassaction']); unset($_GET['massaction']); - if (isset($savid)) $_POST['id'] = ((int) $savid); + unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ? + if (isset($savid)) { + $_POST['id'] = ((int) $savid); + } } // Note: There is another CSRF protection into the filefunc.inc.php @@ -3234,6 +3239,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_PREVIEW' + , token: '' } ); }); @@ -3243,6 +3249,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_DOWNLOAD' + , token: '' } ); }); @@ -3261,7 +3268,7 @@ if (!function_exists("llxFooter")) { $forceping = GETPOST('forceping', 'alpha'); if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) { //print ''; - $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); + $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); // Do not use dol_hash(), must not change if salt changes. if (empty($conf->global->MAIN_FIRST_PING_OK_DATE) || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 30c85197337..94330eb8dc1 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -64,7 +64,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { } if ($action == 'remises') { - if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); @@ -72,7 +72,7 @@ if ($action == 'remises') { } if ($action == 'typemarges') { - if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); @@ -80,7 +80,7 @@ if ($action == 'typemarges') { } if ($action == 'contact') { - if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { + if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 8040c13d606..689503f0dee 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
    '; - $texte .= ''; + $texte .= ''; $texte .= '
    '; // Scan directories diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index f1ca7ce2747..531d463eea1 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -42,6 +42,7 @@ //if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification +//if (! defined('NOSESSION')) define('NOSESSION', '1'); // Disable session // Load Dolibarr environment $res = 0; diff --git a/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql b/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql new file mode 100644 index 00000000000..5026bb4f5d8 --- /dev/null +++ b/htdocs/modulebuilder/template/sql/dolibarr_allversions.sql @@ -0,0 +1,3 @@ +-- +-- Script run when an upgrade of Dolibarr is done. Whatever is the Dolibarr version. +-- diff --git a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql index 4ab8b39d548..2988bd71202 100644 --- a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql +++ b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql @@ -1,14 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- -- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. +-- Script run to make a migration of module version x.x.x to module version y.y.y -- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. + \ No newline at end of file diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 773571b7b1c..bc018a2dda1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -54,6 +54,9 @@ if ($result <= 0) { exit; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('surveycard', 'globalcard')); + $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -134,18 +137,18 @@ if (empty($reshook)) { if (GETPOST('ajoutcomment')) { $error = 0; - if (!GETPOST('comment')) { + if (!GETPOST('comment', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - if (!GETPOST('commentuser')) { + if (!GETPOST('commentuser', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); } if (!$error) { - $comment = (string) GETPOST("comment", "restricthtml"); - $comment_user = (string) GETPOST('commentuser', "restricthtml"); + $comment = (string) GETPOST("comment", "alphanohtml"); + $comment_user = (string) GETPOST('commentuser', "alphanohtml"); $resql = $object->addComment($comment, $comment_user); @@ -338,6 +341,11 @@ if ($action != 'edit') { print ''; +// Other attributes +$parameters = array(); +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print ''; @@ -414,7 +422,7 @@ print '
    '; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
    '; print '
    '."\n"; - print $langs->trans("Name").': '."\n"; + print $langs->trans("Name").': '."\n"; print '
    '."\n"; } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index e37f9bf3de5..5b564f617fd 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -103,13 +103,13 @@ $testmodifier = false; $testligneamodifier = false; $ligneamodifier = -1; for ($i = 0; $i < $nblines; $i++) { - if (isset($_POST['modifierligne'.$i])) { + if (GETPOSTISSET('modifierligne'.$i)) { $ligneamodifier = $i; $testligneamodifier = true; } //test pour voir si une ligne est a modifier - if (isset($_POST['validermodifier'.$i])) { + if (GETPOSTISSET('validermodifier'.$i)) { $modifier = $i; $testmodifier = true; } @@ -153,7 +153,7 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format = //on rajoute la valeur a la fin de tous les sujets deja entrés $nouveauxsujets .= ','; - $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(empty($_POST["typecolonne"]) ? '' : '@'.GETPOST("typecolonne")); + $nouveauxsujets .= str_replace(array(",", "@"), " ", GETPOST("nouvellecolonne")).(!GETPOST("typecolonne") ? '' : '@'.GETPOST("typecolonne")); //mise a jour avec les nouveaux sujets dans la base $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 817f3d88139..762770acee6 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -51,7 +51,8 @@ if (GETPOST('confirmation')) { for ($i = 0; $i < $nbofchoice; $i++) { // Show hours choices for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; $tmphorairesi = GETPOST('horaires'.$i, 'array'); @@ -248,7 +249,8 @@ if (issetAndNoEmpty('moisavant_x') || issetAndNoEmpty('moisavant')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -269,7 +271,8 @@ if (issetAndNoEmpty('moisapres_x') || issetAndNoEmpty('moisapres')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -285,7 +288,8 @@ if (issetAndNoEmpty('anneeavant_x') || issetAndNoEmpty('anneeavant')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -301,7 +305,8 @@ if (issetAndNoEmpty('anneeapres_x') || issetAndNoEmpty('anneeapres')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -365,7 +370,8 @@ if (issetAndNoEmpty('choixjourajout')) { if (issetAndNoEmpty('totalchoixjour', $_SESSION) === true && issetAndNoEmpty('choixjourajout') === true) { $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])) { + $choixjourajout = GETPOST("choixjourajout"); + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])) { $journeuf = false; } } @@ -373,15 +379,17 @@ if (issetAndNoEmpty('choixjourajout')) { // Si le test est passé, alors on insere la valeur dans la variable de session qui contient les dates if ($journeuf && issetAndNoEmpty('choixjourajout') === true) { - array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"])); + $choixjourajout = GETPOST("choixjourajout"); + array_push($_SESSION["totalchoixjour"], dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"])); sort($_SESSION["totalchoixjour"]); - $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourajout"][0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); + $cle = array_search(dol_mktime(0, 0, 0, $_SESSION["mois"], $choixjourajout[0], $_SESSION["annee"]), $_SESSION["totalchoixjour"]); //On sauvegarde les heures deja entrées for ($i = 0; $i < $cle; $i++) { + $horairesi = GETPOST("horaires".$i); for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { if (issetAndNoEmpty('horaires'.$i) === true && issetAndNoEmpty($i, $_POST['horaires'.$i]) === true) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -391,7 +399,8 @@ if (issetAndNoEmpty('choixjourajout')) { $k = $i + 1; if (issetAndNoEmpty('horaires'.$i) === true && issetAndNoEmpty($i, $_POST['horaires'.$i]) === true) { for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$k"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } } @@ -407,12 +416,14 @@ if (issetAndNoEmpty('choixjourretrait')) { for ($i = 0; $i < $nbofchoice; $i++) { //affichage des 5 cases horaires for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { - $_SESSION["horaires$i"][$j] = $_POST["horaires$i"][$j]; + $horairesi = GETPOST("horaires".$i); + $_SESSION["horaires$i"][$j] = $horairesi[$j]; } } for ($i = 0; $i < $nbofchoice; $i++) { - if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $_POST["choixjourretrait"][0], $_SESSION["annee"])) { + $choixjourretrait = GETPOST('choixjourretrait'); + if ($_SESSION["totalchoixjour"][$i] == mktime(0, 0, 0, $_SESSION["mois"], $choixjourretrait[0], $_SESSION["annee"])) { for ($j = $i; $j < $nbofchoice; $j++) { $k = $j + 1; $_SESSION["horaires$j"] = $_SESSION["horaires$k"]; @@ -425,7 +436,7 @@ if (issetAndNoEmpty('choixjourretrait')) { //report des horaires dans toutes les cases if (issetAndNoEmpty('reporterhoraires')) { - $_SESSION["horaires0"] = $_POST["horaires0"]; + $_SESSION["horaires0"] = GETPOST("horaires0"); $nbofchoice = count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { $j = $i + 1; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index b938b3b250f..b9c6cc86113 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -118,7 +118,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Canceled'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,), 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,), @@ -1085,12 +1085,12 @@ class Partnership extends CommonObject $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); $this->labelStatus[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved'); $this->labelStatus[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Terminated'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); $this->labelStatusShort[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved'); $this->labelStatusShort[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Terminated'); } $statusType = 'status'.$status; diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 35b8a3b01e5..ef4f7cfdeb4 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -64,7 +64,7 @@ class PartnershipUtils { global $conf, $langs, $user; - $managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; + $managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if ($managedfor != 'member') { return 0; // If option 'PARTNERSHIP_IS_MANAGED_FOR' = 'thirdparty', this cron job does nothing. diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 6afb9c88912..c83a83e6357 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -79,13 +79,14 @@ $permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd & $permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; -$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; +$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if (empty($conf->partnership->enabled)) accessforbidden(); if (empty($permissiontoread)) accessforbidden(); if ($object->id > 0 && $object->fk_member > 0 && $managedfor != 'member') accessforbidden(); if ($object->id > 0 && $object->fk_soc > 0 && $managedfor != 'thirdparty') accessforbidden(); + /* * Actions */ @@ -273,9 +274,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print ''."\n"; // Common attributes @@ -581,7 +579,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Approve if ($object->status == $object::STATUS_VALIDATED) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Approved'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Approve'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Approved"), 'default', '#', '', 0); @@ -591,7 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Cancel if ($permissiontoadd) { if ($object->status == $object::STATUS_APPROVED) { - print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Resiliate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); } elseif ($object->status > $object::STATUS_APPROVED) { // print ''.$langs->trans("Re-Open").''."\n"; print dolGetButtonAction($langs->trans('Re-Open'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 2703d431e1a..89394960632 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -74,7 +74,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); -$managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; +$managedfor = empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) ? 'thirdparty' : $conf->global->PARTNERSHIP_IS_MANAGED_FOR; if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = ''; diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php new file mode 100644 index 00000000000..d21328da336 --- /dev/null +++ b/htdocs/product/admin/inventory_extrafields.php @@ -0,0 +1,123 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/product/admin/inventory_extrafields.php + * \ingroup stock + * \brief Page to setup extra fields of inventory + */ + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('stock@stock', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader('', $langs->trans("InventorySetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("InventorySetup"), $linkback, 'title_setup'); + + +$head = stock_admin_prepare_head(); + +print dol_get_fiche_head($head, 'inventoryAttributes', $langs->trans("InventoryExtraFields"), -1, 'account'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') { + print '
    '; + print "".$langs->trans("NewAttribute").""; + print "
    "; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
    '; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
    "; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index bac6c958d24..4ede9e1e297 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -202,7 +202,7 @@ class FormProduct /** * Return list of warehouses * - * @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone'=select value if one value otherwise no value, '-2' to use the default value from setup) + * @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) * @param string $htmlname Name of html select html * @param string $filterstatus warehouse status filter, following comma separated filter options can be used * 'warehouseopen' = select products from open warehouses, @@ -279,7 +279,7 @@ class FormProduct } $out .= '
    '."\n"; // Common attributes diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 18a394559a3..db3e8b2ea69 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -159,6 +159,7 @@ if (empty($reshook)) { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); if (!empty($backtopage)) { + $backtopage = str_replace("__ID__", $id, $backtopage); header("Location: ".$backtopage); exit; } else { @@ -959,7 +960,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { $delallowed = $usercancreate; $modulepart = 'stock'; - print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; print '
    '; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b53d67f1bd2..67119ff6839 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -851,7 +851,9 @@ class MouvementStock extends CommonObject */ private function createBatch($dluo, $qty) { - global $user; + global $user, $langs; + + $langs->load('productbatch'); $pdluo = new Productbatch($this->db); @@ -862,7 +864,7 @@ class MouvementStock extends CommonObject $result = $pdluo->fetch($dluo); if (empty($pdluo->id)) { // We didn't find the line. May be it was deleted before by a previous move in same transaction. - $this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.'; + $this->error = $langs->trans('CantMoveNonExistantSerial'); $this->errors[] = $this->error; $result = -2; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index f522e61bec2..3d16b6bac7c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -496,8 +496,8 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans("Save")) { if ((!GETPOST("sellby")) && (!GETPOST("eatby")) && (!$batchnumber)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors'); } else { - $d_eatby = dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); - $d_sellby = dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $d_eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); + $d_sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); $pdluo->batch = $batchnumber; $pdluo->eatby = $d_eatby; $pdluo->sellby = $d_sellby; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index cbf7c901b37..eb6084e5f22 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -386,9 +386,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print '
    '."\n"; // Common attributes diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index ffcf5dd2f00..340fd7dc0df 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -363,7 +363,7 @@ print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, ar print '   '; print img_picto('', 'stock', 'class="pictofiwedwidth"'); print ' '; -print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); +print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); print ''; $parameters = array(); diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 8238d112b7b..c8af7348716 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -196,7 +196,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') } if ($action == 'addtime' && $user->rights->projet->lire) { - $timetoadd = $_POST['task']; + $timetoadd = GETPOST('task'); if (empty($timetoadd)) { setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors'); } else { diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 763ecefe650..6cb4a8600fc 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -257,7 +257,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('assigntask') } if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilteraction') != 'listafterchangingselectedfields') { - $timetoadd = $_POST['task']; + $timetoadd = GETPOST('task'); if (empty($timetoadd)) { setEventMessages($langs->trans("ErrorTimeSpentIsEmpty"), null, 'errors'); } else { diff --git a/htdocs/projet/admin/website.php b/htdocs/projet/admin/website.php index 1af6b72c196..25497fef436 100644 --- a/htdocs/projet/admin/website.php +++ b/htdocs/projet/admin/website.php @@ -111,33 +111,6 @@ if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) { print $enabledisablehtml; print ''; -/* -print '
    '; - -if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) { - print '
    '; - - print '
    '; - - print ''; - print ''; - print ''; - print "\n"; - - // param - print '\n"; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "
    '; - - print '
    '; - print ''; - print '
    '; -} -*/ print dol_get_fiche_end(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b19bc407537..163f7f8d9df 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -699,7 +699,7 @@ if ($search_opp_percent != '') { if ($search_public != '') { $param .= '&search_public='.urlencode($search_public); } -if ($search_project_user != '') { +if ($search_project_user > 0) { $param .= '&search_project_user='.urlencode($search_project_user); } if ($search_project_contact != '') { @@ -821,12 +821,12 @@ $includeonly = ''; if (empty($user->rights->user->user->lire)) { $includeonly = array($user->id); } -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250'); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; $moreforfilter .= '
    '; $tmptitle = $langs->trans('ProjectsWithThisContact'); -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
    '; // If the user can view thirdparties other than his' @@ -834,7 +834,7 @@ if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
    '; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
    '; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 64d134a7254..310857e24cc 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -303,8 +303,6 @@ if ($action == 'createtask' && $user->rights->projet->creer) { $error = 0; // If we use user timezone, we must change also view/list to use user timezone everywhere - //$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); - //$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); $date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int')); $date_end = dol_mktime(GETPOST('dateehour', 'int'), GETPOST('dateemin', 'int'), 0, GETPOST('dateemonth', 'int'), GETPOST('dateeday', 'int'), GETPOST('dateeyear', 'int')); @@ -318,7 +316,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; $error++; - } elseif (empty($_POST['task_parent'])) { + } elseif (!GETPOST('task_parent')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ChildOfProjectTask")), null, 'errors'); $action = 'create'; $error++; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 155cb261040..c57610d0130 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -74,7 +74,7 @@ $socid = 0; restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); -$permissiontoadd = $$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->rights->projet->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php /* diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8e773f92788..19be96cc558 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -91,7 +91,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { if (!$error) { $object->oldcopy = clone $object; - $tmparray = explode('_', $_POST['task_parent']); + $tmparray = explode('_', GETPOST('task_parent')); $task_parent = $tmparray[1]; if (empty($task_parent)) { $task_parent = 0; // If task_parent is '' diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index bc6ec7d15cf..ef8ac6aa9df 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -659,9 +659,10 @@ if ($action == 'confirm_generateinter') { if (!$error) { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent + // Get userid, timespent $object->fetchTimeSpent($value); // $object->id is the task id + $arrayoftasks[$object->timespent_id]['id'] = $object->id; $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; @@ -670,7 +671,7 @@ if ($action == 'confirm_generateinter') { foreach ($arrayoftasks as $timespent_id => $value) { $ftask = new Task($db); - $ftask->fetch($object->id); + $ftask->fetch($value['id']); // Define qty per hour $qtyhour = $value['timespent'] / 3600; $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); @@ -1433,12 +1434,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Note print ''; - print ''; + print ''; print ''; // Duration - Time spent print ''; - $durationtouse = ($_POST['timespent_duration'] ? $_POST['timespent_duration'] : ''); + $durationtouse = (GETPOST('timespent_duration') ? GETPOST('timespent_duration') : ''); if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) { $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 94ee0bb00b2..49bde1a2b9b 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -212,7 +212,7 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') { // Action run when we click o // If we disable modules using personalized list foreach ($modules as $val) { $modulekeyname = strtolower($val->name); - if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) { + if (!GETPOST($modulekeyname) && empty($val->always_enabled) && !in_array($modulekeyname, $alwayscheckedmodules)) { $disablestring .= $modulekeyname.','; if ($modulekeyname == 'propale') { $disablestring .= 'propal,'; diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index b350ece39f4..a7cdd1ceda8 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -19,16 +19,6 @@ * \file htdocs/public/eventorganization/attendee_new.php * \ingroup project * \brief Example of form to subscribe to an event - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { @@ -66,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 4a81084223d..8acf3daba78 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -57,7 +57,7 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root, $mysoc; +global $dolibarr_main_url_root, $mysoc; $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6589f2a17d0..055ffec56f9 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,6 +30,7 @@ * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 42cde055ac2..a1c9efed6c3 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -79,8 +79,8 @@ if (GETPOST('ajoutcomment', 'alpha')) { $error = 0; - $comment = GETPOST("comment", 'restricthtml'); - $comment_user = GETPOST('commentuser', 'nohtml'); + $comment = GETPOST("comment", 'alphanohtml'); + $comment_user = GETPOST('commentuser', 'alphanohtml'); if (!$comment) { $error++; @@ -202,7 +202,6 @@ for ($i = 0; $i < $nblines; $i++) { } if ($testmodifier) { - //var_dump($_POST);exit; $nouveauchoix = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (GETPOSTISSET("choix".$i) && GETPOST("choix".$i) == '1') { @@ -781,9 +780,9 @@ if ($comments) { if ($object->allow_comments) { print '
    '.$langs->trans("AddACommentForPoll")."
    \n"; - print '
    '."\n"; + print '
    '."\n"; print $langs->trans("Name").': '; - print '   '."\n"; + print '   '."\n"; print '
    '."\n"; print ''."\n"; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 5158e294fb2..7bb61a708c5 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -70,9 +70,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data @@ -481,7 +478,7 @@ if ($action == 'dopayment') { // Called when choosing Stripe mode. -// When using the Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. +// When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. // When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge. if ($action == 'charge' && !empty($conf->stripe->enabled)) { $amountstripe = $amount; @@ -728,7 +725,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { } } - // When using the PaymentIntent API architecture + // When using the PaymentIntent API architecture (mode set on by default into conf.class.php) if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { $service = 'StripeTest'; $servicestatus = 0; @@ -793,8 +790,8 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { $remoteip = getUserRemoteIP(); $_SESSION["onlinetoken"] = $stripeToken; - $_SESSION["FinalPaymentAmt"] = $amount; - $_SESSION["currencyCodeType"] = $currency; + $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. + $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. $_SESSION["paymentType"] = ''; $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index c822bfcdf96..9765af89f7e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -61,8 +61,6 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id; - $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal")); // Clean parameters @@ -412,12 +410,12 @@ if ($ispaymentok) { $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); + dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { // Security protection: - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount (if free amount is allowed, no need to check) if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. $typeid = $object->typeid; @@ -440,6 +438,17 @@ if ($ispaymentok) { } } + // Security protection: + if (!empty($conf->global->MEMBER_MIN_AMOUNT)) { + if ($FinalPaymentAmt < $conf->global->MEMBER_MIN_AMOUNT) { + $error++; + $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.$conf->global->MEMBER_MIN_AMOUNT.'). May be a hack to try to pay a different amount ?'; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + dol_syslog("Failed to validate member (amount lower than minimum): ".$errmsg, LOG_ERR, 0, '_payment'); + } + } + // Security protection: if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one $error++; diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 5f450a6c557..0add64bb700 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -54,9 +54,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index c0bcdc751c6..cb1b1089b0c 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestbooth.php * \ingroup member * \brief Example of form to suggest a booth - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { @@ -66,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index f2a919c0aa2..22589c941d2 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestconference.php * \ingroup member * \brief Example of form to suggest a conference - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { @@ -66,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index e680df15a1c..805eb8cfdd1 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -56,7 +56,7 @@ $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); // For encryption -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; +global $dolibarr_main_url_root; // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 6a3fd1aa688..51424d9277e 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -126,7 +126,7 @@ if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alph $upload_dir_tmp = $vardir.'/temp/'.session_id(); // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0, 0); + dol_remove_file_process(GETPOST('removedfile'), 0, 0); $action = 'create_ticket'; } @@ -259,7 +259,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

    '; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
    '; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
    '; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

    '; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 2d7c46e0c85..93140b88ef5 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -323,7 +323,6 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - //var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit; //reception line for product with no batch management and no multiple stock location if (GETPOST($qty, 'alpha') > 0) { $totalqty += price2num(GETPOST($qty, 'alpha'), 'MS'); @@ -335,7 +334,6 @@ if (empty($reshook)) { if ($totalqty > 0) { // There is at least one thing to ship - //var_dump($_POST);exit; for ($i = 1; $i <= $num; $i++) { $lineToTest = ''; $lineId = GETPOST($idl, 'int'); @@ -466,7 +464,6 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); }*/ } elseif ($action == 'setdate_livraison' && $permissiontoadd) { - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); @@ -956,10 +953,10 @@ if ($action == 'create') { $ent = 'entrepot_' . $paramSuffix; $pu = 'pu_' . $paramSuffix; $lot = 'lot_number_' . $paramSuffix; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$paramSuffix.'month'], $_POST['dluo_'.$paramSuffix.'day'], $_POST['dluo_'.$paramSuffix.'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$paramSuffix.'month'], $_POST['dlc_'.$paramSuffix.'day'], $_POST['dlc_'.$paramSuffix.'year']); + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$paramSuffix.'month', 'int'), GETPOST('dluo_'.$paramSuffix.'day', 'int'), GETPOST('dluo_'.$paramSuffix.'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$paramSuffix.'month', 'int'), GETPOST('dlc_'.$paramSuffix.'day', 'int'), GETPOST('dlc_'.$paramSuffix.'year', 'int')); $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; - $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page, it means that post was sent but an error occured diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php index 3d431d026bc..b091cdea7a0 100644 --- a/htdocs/recruitment/admin/public_interface.php +++ b/htdocs/recruitment/admin/public_interface.php @@ -126,44 +126,6 @@ if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { print ''.$langs->trans("Value").''; print "\n"; - // Force Type - $adht = new AdherentType($db); - print ''; - print $langs->trans("ForceMemberType"); - print ''; - $listofval = array(); - $listofval += $adht->liste_array(); - $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; - print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0); - print "\n"; - - // Amount - print ''; - print $langs->trans("DefaultAmount"); - print ''; - print ''; - print "\n"; - - // Can edit - print ''; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "\n"; - - // Jump to an online payment page - print ''; - print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); - print ''; - $listofval = array(); - $listofval['-1'] = $langs->trans('No'); - $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; - if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox'; - if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal'; - if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe'; - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); - print "\n"; - print ''; print '
    '; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index e818a0816a9..e2b7c545aa9 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -158,7 +158,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $texte .= $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
    '; - $texte .= ''; + $texte .= ''; $texte .= '
    '; // Scan directories diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index ac6fc37591a..42145f66c43 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -325,9 +325,6 @@ if ($action == 'create') { print dol_get_fiche_head(array(), ''); - // Set some default values - //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; - print ''."\n"; // Common attributes diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index d0ca6416390..068dba8c50a 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -383,7 +383,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -396,7 +397,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 221e5cf2c0e..cfca26efca4 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -87,7 +87,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num($_POST[$key]); + $amounts[$other_chid] = price2num(GETPOST($key)); } } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 193dfc43cad..55161f42e09 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -626,7 +626,7 @@ foreach ($dirsociete as $dirroot) { // Preview print '"; } print ''; @@ -801,7 +801,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print '"; } print ''; @@ -905,7 +905,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; print ''; print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a7d0bdc87c8..bc6a96bb990 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; + /** * Class to manage third parties objects (customers, suppliers, prospects...) */ @@ -898,8 +899,8 @@ class Societe extends CommonObject $sql .= ", name_alias"; $sql .= ", entity"; $sql .= ", datec"; - $sql .= ", fk_typent"; $sql .= ", fk_user_creat"; + $sql .= ", fk_typent"; $sql .= ", canvas"; $sql .= ", status"; $sql .= ", ref_ext"; @@ -2329,7 +2330,7 @@ class Societe extends CommonObject /** * Return array of sales representatives * - * @param User $user Object user + * @param User $user Object user (not used) * @param int $mode 0=Array with properties, 1=Array of id. * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb' * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'; @@ -2573,7 +2574,7 @@ class Societe extends CommonObject $name .= ' ('.$this->name_alias.')'; } - $result = ''; $label = ''; + $result = ''; $label = ''; $label2 = ''; $linkstart = ''; $linkend = ''; if (!empty($this->logo) && class_exists('Form')) { @@ -2641,47 +2642,48 @@ class Societe extends CommonObject } $label .= '
    '.implode(' ', $phonelist); } + if (!empty($this->address)) { - $label .= '
    '.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country + $label2 .= '
    '.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country } elseif (!empty($this->country_code)) { - $label .= '
    '.$langs->trans('Country').': '.$this->country_code; + $label2 .= '
    '.$langs->trans('Country').': '.$this->country_code; } if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) { - $label .= '
    '.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra); + $label2 .= '
    '.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra); } if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) { if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false) { - $label .= '
    '.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1; + $label2 .= '
    '.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1; } if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false) { - $label .= '
    '.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2; + $label2 .= '
    '.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2; } if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false) { - $label .= '
    '.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3; + $label2 .= '
    '.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3; } if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false) { - $label .= '
    '.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4; + $label2 .= '
    '.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4; } if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false) { - $label .= '
    '.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5; + $label2 .= '
    '.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5; } if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false) { - $label .= '
    '.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6; + $label2 .= '
    '.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6; } } if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) { - $label .= '
    '.$langs->trans('CustomerCode').': '.$this->code_client; + $label2 .= '
    '.$langs->trans('CustomerCode').': '.$this->code_client; } if (!empty($this->code_fournisseur) && $this->fournisseur) { - $label .= '
    '.$langs->trans('SupplierCode').': '.$this->code_fournisseur; + $label2 .= '
    '.$langs->trans('SupplierCode').': '.$this->code_fournisseur; } if (!empty($conf->accounting->enabled) && ($this->client == 1 || $this->client == 3)) { - $label .= '
    '.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); + $label2 .= '
    '.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); } if (!empty($conf->accounting->enabled) && $this->fournisseur) { - $label .= '
    '.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; + $label2 .= '
    '.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; } - $label .= ''; + $label .= ($label2 ? '
    '.$label2 : '').''; // Add type of canvas $linkstart .= (!empty($this->canvas) ? '&canvas='.$this->canvas : ''); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index da056ec33da..81ceb22b9c4 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1604,11 +1604,11 @@ while ($i < min($num, $limit)) { } // VAT if (!empty($arrayfields['s.tva_intra']['checked'])) { - print "\n"; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 75818a34f72..897a372dc27 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -156,7 +156,7 @@ if (empty($reshook)) { $action = ''; } - if ($action == 'update_customer_price_confirm' && !$_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { + if ($action == 'update_customer_price_confirm' && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) { $prodcustprice->fetch(GETPOST('lineid', 'int')); $update_child_soc = GETPOST('updatechildprice'); diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 82d815f0ac4..df10c0d4bf9 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -111,13 +111,6 @@ if ($action == 'addcontact' && $user->rights->societe->creer) { dol_print_error($db); } } -/* -elseif ($action == 'setaddress' && $user->rights->societe->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index a5837c2557f..b66dfc94ed6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -244,7 +244,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'))); if ($result < 0) { dol_print_error($db, $object->error); } @@ -895,7 +895,7 @@ if (empty($reshook)) { if (!empty($productid)) { $productsupplier = new ProductFournisseur($db); if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) { - if ($productid > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), $productid, 'none', GETPOST('socid', 'int')) < 0) { + if ($productid > 0 && $productsupplier->get_buyprice(0, price2num(GETPOST('qty')), $productid, 'none', GETPOST('socid', 'int')) < 0) { setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings'); } } @@ -1007,7 +1007,7 @@ if (empty($reshook)) { $object->setProject(GETPOST('projectid'), 'int'); } elseif ($action == 'setavailability' && $usercancreate) { // Delivery delay - $result = $object->availability($_POST['availability_id']); + $result = $object->availability(GETPOST('availability_id')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payments $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5ce837e160c..2b3f1c5efe0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -223,7 +223,7 @@ input { padding-left: 5px; } select { - padding-top: 5px; + padding-top: 4px; padding-right: 4px; padding-bottom: 5px; padding-left: 2px; @@ -264,7 +264,8 @@ input:invalid, select:invalid, input.--error , select.--error { section.setupsection { padding: 20px; - background-color: var(--colorbacktitle1); + /* background-color: var(--colorbacktitle1); */ + background-color: #f0f0f0; border-radius: 5px; } @@ -549,6 +550,13 @@ div#moretabsList, div#moretabsListaction { hr { border: 0; border-top: 1px solid #ccc; } .tabBar hr { margin-top: 20px; margin-bottom: 17px; } + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} + .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { margin-bottom: 3px; @@ -728,6 +736,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } @@ -3491,11 +3502,10 @@ table.border, table.bordernooddeven, table.dataTable, .table-border, .table-bord table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 22px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 22px; + height: 28px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { @@ -3503,17 +3513,15 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border } div .tdtop { vertical-align: top !important; - /*padding-top: 10px !important; - padding-bottom: 2px !important; */ } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 5px 2px 5px 2px; + padding: 2px 2px 2px 2px; border-collapse: collapse; } div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd, div.tabBar div.border div div.tagtd { - padding-top: 5px; + padding-top: 2px; border-bottom: 1px solid #E0E0E0; } @@ -5238,7 +5246,7 @@ td.cal_other_month { /* ============================================================================== */ /* CSS for treeview */ -.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 8px !important; } +.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 2px !important; } .treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 30px; } .treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; } .treeview .hitarea { margin-top: 3px; } @@ -5917,6 +5925,7 @@ span#select2-taskid-container[title^='--'] { } span.select2.select2-container.select2-container--default { + text-align: initial; global->THEME_SHOW_BORDER_ON_INPUT)) { ?> border-left: none; border-top: none; @@ -6234,6 +6243,10 @@ span#select2-boxbookmark-container { overflow: hidden; } +ul.select2-results__options li { + font-size: 0.95em; +} + /* ============================================================================== */ /* For categories */ @@ -6253,7 +6266,7 @@ span.noborderoncategories a, li.noborderoncategories a { /* vertical-align: top; */ } span.noborderoncategories { - padding: 4px 5px 0px 5px; + padding: 3px 5px 3px 5px; display: inline-block; } .categtextwhite, .treeview .categtextwhite.hover { @@ -7400,7 +7413,7 @@ div.clipboardCPValue.hidewithsize { } #divbodywebsite { - word-break: break-all; + word-break: break-word; } .websiteselectionsection { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index da706095e17..700449d177a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -730,6 +730,14 @@ div#moretabsList, div#moretabsListaction { } hr { border: 0; border-top: 1px solid #ccc; } +.tabBar hr { margin-top: 20px; margin-bottom: 17px; } + + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { border-color: #c5c5c5; @@ -885,6 +893,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } @@ -3561,15 +3572,14 @@ table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 26px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 26px; + height: 28px; } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 4px 4px 4px 4px; + padding: 3px 4px 3px 4px; border: 1px solid #f0f0f0; border-collapse: collapse; } @@ -6110,6 +6120,14 @@ span#select2-boxbookmark-container, span#select2-boxcombo-container { overflow: hidden; } +span.select2.select2-container.select2-container--default { + text-align: initial; +} + +ul.select2-results__options li { + font-size: 0.95em; +} + /* ============================================================================== */ /* For categories */ @@ -6127,7 +6145,7 @@ span.noborderoncategories a, li.noborderoncategories a { line-height: normal; } span.noborderoncategories { - padding: 3px 5px 0px 5px; + padding: 3px 5px 3px 5px; } .categtextwhite, .treeview .categtextwhite.hover { color: #fff !important; @@ -7219,7 +7237,7 @@ div.clipboardCPValue.hidewithsize { } #divbodywebsite { - word-break: break-all; + word-break: break-word; } .websiteselectionsection { diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 44b9edf358e..d362dcbdabd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -329,8 +329,6 @@ if (empty($reshook)) { $form = new Form($db); $formTicket = new FormTicket($db); -$now = dol_now(); - $user_temp = new User($db); $socstatic = new Societe($db); @@ -621,10 +619,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { - foreach ($search[$key] as $skey) { + if (is_array($val) && count($val)) { + foreach ($val as $skey) { if ($skey != '') { - $param .= '&search_'.$key.'[]='.urlencode($skey); + $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } } } elseif ($search[$key] != '') { @@ -942,6 +940,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; +$now = dol_now(); $cacheofoutputfield = array(); while ($i < ($limit ? min($num, $limit) : $num)) { @@ -952,6 +951,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->status = $object->fk_statut; // fk_statut is deprecated // Show here line of result print ''; @@ -1033,6 +1033,26 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + } elseif ($key == 'ref') { + print $object->showOutputField($val, $key, $obj->$key, ''); + + // display a warning on untreated tickets + $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); + $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + if ($is_open && $should_show_warning) { + $date_last_msg_sent = (int) $object->date_last_msg_sent; + $hour_diff = ($now - $date_last_msg_sent) / 3600 ; + + if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + $creation_date = $object->datec; + $hour_diff_creation = ($now - $creation_date) / 3600 ; + if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + } + } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } + } } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... $tmp = explode(':', $val['type']); if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index c5103278dda..d2149f611ff 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -402,12 +402,14 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); - $object->login = GETPOST("login", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; - if (!empty($user->admin)) { - $object->admin = GETPOST("admin", "int"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + if (!empty($user->admin)) { // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + $object->admin = GETPOST("admin", "int"); + } + if ($user->admin && !$object->ldap_sid) { // same test than on edit page + $object->login = GETPOST("login", 'alphanohtml'); } $object->address = GETPOST('address', 'alphanohtml'); $object->zip = GETPOST('zipcode', 'alphanohtml'); @@ -543,14 +545,14 @@ if (empty($reshook)) { if (!$error && !count($object->errors)) { if (GETPOST('deletephoto') && $object->oldcopy->photo) { - $fileimg = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').$object->oldcopy->photo; - $dirthumbs = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/thumbs'; + $fileimg = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->oldcopy->photo; + $dirthumbs = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'photos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { - $dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'user'); + $dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'user').'/photos'; dol_mkdir($dir); @@ -915,7 +917,7 @@ if ($action == 'create' || $action == 'adduserldap') { $defaultemployee = '1'; print ''; print ''; @@ -1823,75 +1825,112 @@ if ($action == 'create' || $action == 'adduserldap') { /* * Buttons actions */ - print '
    '; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if (empty($user->socid)) { + $canSendMail = false; + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if (!empty($object->email)) { $langs->load("mails"); - print ''; + $canSendMail = true; } else { $langs->load("mails"); - print ''; + $params['attr']['title'] = $langs->trans('NoEMail'); } + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); } if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { - print ''; + $params['attr']['title'] = $langs->trans('DisabledInMonoUserMode'); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); } else { - print ''; + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken(), '', true, $params); } } elseif ($caneditpassword && !$object->ldap_sid && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit', '', true, $params); } // Si on a un gestionnaire de generation de mot de passe actif + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if ($conf->global->USER_PASSWORD_GENERATED != 'none') { if ($object->statut == 0) { - print ''; - } elseif ($caneditpassword && $object->login && !$object->ldap_sid && + $params['attr']['title'] = $langs->trans('UserDisabled'); + print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); + } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params); } if ($object->statut == 0) { - print ''; - } elseif ($caneditpassword && $object->login && !$object->ldap_sid && + $params['attr']['title'] = $langs->trans('UserDisabled'); + print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); + } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { if ($object->email) { - print ''; + print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params); } else { - print ''; + $params['attr']['title'] = $langs->trans('NoEMail'); + print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); } } } // Enable user + $params = array( + 'attr' => array( + 'title' => '', + 'class' => 'classfortooltip' + ) + ); if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken().$langs->trans("Reactivate"), '', true, $params); } // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken().$langs->trans("DisableUser"), '', true, $params); } else { if ($user->id == $id) { - print ''; + $params['attr']['title'] = $langs->trans('CantDisableYourself'); + print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params); } } // Delete if ($user->id <> $id && $candisableuser && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin - print ''; + print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params); } else { - print ''; + $params['attr']['title'] = $langs->trans('MustBeAdminToDeleteOtherAdmin'); + print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', false, $params); } } } @@ -1900,7 +1939,7 @@ if ($action == 'create' || $action == 'adduserldap') { - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 736dcf99680..6c5926f8c43 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -348,8 +348,8 @@ class User extends CommonObject public $fields = array( 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1), - 'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'lastname'=>array('type'=>'varchar(50)', 'label'=>'LastName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1), + 'firstname'=>array('type'=>'varchar(50)', 'label'=>'FirstName', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), ); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 80f83732906..bb1320ecd0b 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) { if (!empty($conf->agenda->enabled)) { $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda'; } +if (!empty($conf->ticket->enabled)) { + $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; +} $head = user_prepare_head($object); diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 5da92482785..dabac0727dc 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -113,7 +113,7 @@ if (empty($reshook)) { // Action modif mot de passe if ($action == 'buildnewpassword' && $username) { $sessionkey = 'dol_antispam_value'; - $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); + $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code')))); // Verify code if (!$ok) { diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 1569fcabb39..64fa6b08b93 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -262,7 +262,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( exit(); } - $prodcomb->variation_weight = $weight_impact; + $prodcomb->variation_weight = price2num($weight_impact); // for conf PRODUIT_MULTIPRICES if ($conf->global->PRODUIT_MULTIPRICES) { diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index dee62999cf4..7f34bdb6a18 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -230,7 +230,7 @@ $original_file = str_replace('..\\', '/', $original_file); $refname = basename(dirname($original_file)."/"); // Check that file is allowed for view with viewimage.php -if (!dolIsAllowedForPreview($original_file)) { +if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) { accessforbidden('This file is not qualified for preview', 0, 0, 1); } diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 926fa8f6418..1581d569f27 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -350,8 +350,8 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) if (!$error) { $linesinvoice = array(); - $sql .= "SELECT f.rowid as facid"; - $sql .= " FROM '.MAIN_DB_PREFIX.'facture_fourn as f"; + $sql = "SELECT f.rowid as facid"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.entity = ".((int) $conf->entity); if ($idthirdparty != 'all') { $sql .= " AND f.fk_soc = ".((int) $idthirdparty); diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 0e66e01db01..80a48048151 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -655,6 +655,13 @@ class Website extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); + $newref = dol_sanitizeFileName($newref); + + if (empty($newref)) { + $this->error = 'ErrorBadParameter'; + return -1; + } + $object = new self($this->db); // Check no site with ref exists @@ -671,8 +678,8 @@ class Website extends CommonObject $oldidforhome = $object->fk_default_home; $oldref = $object->ref; - $pathofwebsiteold = $dolibarr_main_data_root.'/website/'.$oldref; - $pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$newref; + $pathofwebsiteold = $dolibarr_main_data_root.'/website/'.dol_sanitizeFileName($oldref); + $pathofwebsitenew = $dolibarr_main_data_root.'/website/'.dol_sanitizeFileName($newref); dol_delete_dir_recursive($pathofwebsitenew); $fileindex = $pathofwebsitenew.'/index.php'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 610607f0321..d0574d49fee 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1406,176 +1406,262 @@ if ($action == 'updatecss' && $usercanedit) { } + $dataposted = trim(GETPOST('WEBSITE_HTML_HEADER', 'none')); + $dataposted = preg_replace(array('/\n*/ims', '/<\/html>\n*/ims'), array('', ''), $dataposted); + $dataposted = str_replace('\n";*/ + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $htmlheadercontent .= preg_replace(array('/\n*/ims', '/<\/html>\n*/ims'), array('', ''), GETPOST('WEBSITE_HTML_HEADER', 'none')); + if (!$errorphpcheck) { + $htmlheadercontent = ''; - /*$htmlheadercontent.= "\n".'"."\n";*/ + /* We disable php code since htmlheader is never executed as an include but only read by fgets_content. + $htmlheadercontent.= "\n";*/ - $htmlheadercontent = trim($htmlheadercontent)."\n"; + $htmlheadercontent .= $dataposted."\n"; - $result = dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); - if (!$result) { + /*$htmlheadercontent.= "\n".'"."\n";*/ + + $result = dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors'); } + $dataposted = trim(GETPOST('WEBSITE_CSS_INLINE', 'none')); + $dataposted = str_replace('\n"; + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $csscontent .= trim(GETPOST('WEBSITE_CSS_INLINE', 'none'))."\n"; + if (!$errorphpcheck) { + $csscontent = ''; - $csscontent .= '\n"; + $csscontent .= "\n"; - dol_syslog("Save css content into ".$filecss); + $csscontent .= $dataposted."\n"; - $result = dolSaveCssFile($filecss, $csscontent); - if (!$result) { + $csscontent .= '\n"; + + dol_syslog("Save css content into ".$filecss); + + $result = dolSaveCssFile($filecss, $csscontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filecss, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filecss, null, 'errors'); } + $dataposted = trim(GETPOST('WEBSITE_JS_INLINE', 'none')); + $dataposted = str_replace('\n"; + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $jscontent .= trim(GETPOST('WEBSITE_JS_INLINE', 'none'))."\n"; + if (!$errorphpcheck) { + $jscontent = ''; - $jscontent .= '\n"; + $jscontent .= "\n"; - $result = dolSaveJsFile($filejs, $jscontent); - if (!$result) { + $jscontent .= $dataposted."\n"; + + $jscontent .= '\n"; + + $result = dolSaveJsFile($filejs, $jscontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filejs, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filejs, null, 'errors'); } + $dataposted = trim(GETPOST('WEBSITE_ROBOT', 'restricthtml')); + $dataposted = str_replace('\n";*/ + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $robotcontent .= trim(GETPOST('WEBSITE_ROBOT', 'restricthtml'))."\n"; + if (!$errorphpcheck) { + $robotcontent = ''; - /*$robotcontent.= "\n".'"."\n";*/ + /*$robotcontent.= "\n";*/ - $result = dolSaveRobotFile($filerobot, $robotcontent); - if (!$result) { + $robotcontent .= $dataposted."\n"; + + /*$robotcontent.= "\n".'"."\n";*/ + + $result = dolSaveRobotFile($filerobot, $robotcontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filerobot, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filerobot, null, 'errors'); } + $dataposted = trim(GETPOST('WEBSITE_HTACCESS', 'restricthtml')); + $dataposted = str_replace('\n"; + // Manifest.json file + $phpfullcodestringold = ''; + $phpfullcodestring = dolKeepOnlyPhpCode($dataposted); - $manifestjsoncontent .= trim(GETPOST('WEBSITE_MANIFEST_JSON', 'none'))."\n"; + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $manifestjsoncontent .= '\n"; + if (!$errorphpcheck) { + $manifestjsoncontent = ''; - $result = dolSaveManifestJson($filemanifestjson, $manifestjsoncontent); - if (!$result) { + $manifestjsoncontent .= "\n"; + + $manifestjsoncontent .= $dataposted."\n"; + + $manifestjsoncontent .= '\n"; + + $result = dolSaveManifestJson($filemanifestjson, $manifestjsoncontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filemanifestjson, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filemanifestjson, null, 'errors'); } + $dataposted = trim(GETPOST('WEBSITE_README', 'restricthtml')); + $dataposted = str_replace('\n";*/ + // Security analysis + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages - $readmecontent .= trim(GETPOST('WEBSITE_README', 'restricthtml'))."\n"; + if (!$errorphpcheck) { + $readmecontent = ''; - /*$readmecontent.= '"."\n";*/ + /*$readmecontent.= "\n";*/ - $result = dolSaveReadme($filereadme, $readmecontent); - if (!$result) { + $readmecontent .= $dataposted."\n"; + + /*$readmecontent.= '"."\n";*/ + + $result = dolSaveReadme($filereadme, $readmecontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filereadme, null, 'errors'); + } + } else { $error++; - setEventMessages('Failed to write file '.$filereadme, null, 'errors'); } @@ -1999,57 +2085,17 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' || $objectpage->content = GETPOST('PAGE_CONTENT', 'none'); - // Security analysis $phpfullcodestring = dolKeepOnlyPhpCode($objectpage->content); - // First check forbidden commands - $forbiddenphpcommands = array(); - if (empty($conf->global->WEBSITE_PHP_ALLOW_EXEC)) { // If option is not on, we disallow functions to execute commands - $forbiddenphpcommands = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI"); - } - if (empty($conf->global->WEBSITE_PHP_ALLOW_WRITE)) { // If option is not on, we disallow functions to write files - $forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "unlink", "mkdir", "rmdir", "symlink", "touch", "umask")); - } - foreach ($forbiddenphpcommands as $forbiddenphpcommand) { - if (preg_match('/'.$forbiddenphpcommand.'\s*\(/ms', $phpfullcodestring)) { - $error++; - setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpcommand), null, 'errors'); - if ($action == 'updatesource') { - $action = 'editsource'; - } - if ($action == 'updatecontent') { - $action = 'editcontent'; - } - } - } - // This char can be used to execute RCE for example using with echo `ls` - $forbiddenphpchars = array(); - if (empty($conf->global->WEBSITE_PHP_ALLOW_DANGEROUS_CHARS)) { // If option is not on, we disallow functions to execute commands - $forbiddenphpchars = array("`"); - } - foreach ($forbiddenphpchars as $forbiddenphpchar) { - if (preg_match('/'.$forbiddenphpchar.'/ms', $phpfullcodestring)) { - $error++; - setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar), null, 'errors'); - if ($action == 'updatesource') { - $action = 'editsource'; - } - if ($action == 'updatecontent') { - $action = 'editcontent'; - } - } - } + // Security analysis + $error = checkPHPCode($phpfullcodestringold, $phpfullcodestring); - if (empty($user->rights->website->writephp)) { - if ($phpfullcodestringold != $phpfullcodestring) { - $error++; - setEventMessages($langs->trans("NotAllowedToAddDynamicContent"), null, 'errors'); - if ($action == 'updatesource') { - $action = 'editsource'; - } - if ($action == 'updatecontent') { - $action = 'editcontent'; - } + if ($error) { + if ($action == 'updatesource') { + $action = 'editsource'; + } + if ($action == 'updatecontent') { + $action = 'editcontent'; } } @@ -3368,7 +3414,8 @@ if ($action == 'editcss') { print $form->textwithpicto($langs->trans('WEBSITE_CSS_INLINE'), $htmlhelp, 1, 'help', '', 0, 2, 'csstooltip'); print '
    '; @@ -3381,7 +3428,8 @@ if ($action == 'editcss') { print ''; @@ -3396,7 +3444,8 @@ if ($action == 'editcss') { print $form->textwithpicto($textwithhelp, $htmlhelp2, 1, 'warning', '', 0, 2, 'htmlheadertooltip2'); print ''; @@ -3406,7 +3455,8 @@ if ($action == 'editcss') { print $langs->trans('WEBSITE_ROBOT'); print ''; @@ -3416,7 +3466,8 @@ if ($action == 'editcss') { print $langs->trans('WEBSITE_HTACCESS'); print ''; @@ -3428,7 +3479,9 @@ if ($action == 'editcss') { print $form->textwithpicto($langs->trans('WEBSITE_MANIFEST_JSON'), $htmlhelp, 1, 'help', '', 0, 2, 'manifestjsontooltip'); print ''; @@ -3438,7 +3491,8 @@ if ($action == 'editcss') { print $form->textwithpicto($langs->trans('WEBSITE_README'), $htmlhelp, 1, 'help', '', 0, 2, 'readmetooltip'); print ''; @@ -3487,7 +3541,7 @@ if ($action == 'createsite') { $siteref = $sitedesc = $sitelang = $siteotherlang = ''; if (GETPOST('WEBSITE_REF')) { - $siteref = GETPOST('WEBSITE_REF', 'alpha'); + $siteref = GETPOST('WEBSITE_REF', 'aZ09'); } if (GETPOST('WEBSITE_DESCRIPTION')) { $sitedesc = GETPOST('WEBSITE_DESCRIPTION', 'alpha'); @@ -3952,7 +4006,8 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties $htmlhelp .= dol_htmlentitiesbr($htmlheadercontentdefault); print $form->textwithpicto($langs->trans('HtmlHeaderPage'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip'); print ''; @@ -4096,9 +4151,10 @@ if ($action == 'editsource') { $maxheightwin = $_SESSION["dol_screenheight"] - 490; } } - //var_dump($_SESSION["dol_screenheight"]); + + $poscursor = array('x'=>GETPOST('PAGE_CONTENT_x'), 'y'=>GETPOST('PAGE_CONTENT_y')); require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('PAGE_CONTENT', $contentforedit, '', $maxheightwin, 'Full', '', true, true, 'ace', ROWS_5, '40%'); + $doleditor = new DolEditor('PAGE_CONTENT', $contentforedit, '', $maxheightwin, 'Full', '', true, true, 'ace', ROWS_5, '40%', 0, $poscursor); $doleditor->Create(0, '', false, 'HTML Source', 'php'); } @@ -4115,7 +4171,8 @@ if ($action == 'editsource') { $contentforedit = preg_replace('/(GETPOST('PAGE_CONTENT_x'), 'y'=>GETPOST('PAGE_CONTENT_y')); + $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%',$poscursor); $doleditor->Create(0, '', false); }*/ diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 7a8a31167e6..9b0ef597a6f 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -444,7 +444,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); preg_match_all('/GETPOST\s*\(([^\)]+),\s*["\']none["\']/i', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { - var_dump($val); + //var_dump($val); if (!in_array($val[1], array( "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", "'search_status'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"'))) { diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 15e4eaa8bda..ad73d5ce14a 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -574,7 +574,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["backtopage"]='javascripT&javascript#javascriptxjavascript3a alert(1)'; $result=GETPOST("backtopage"); print __METHOD__." result=".$result."\n"; - $this->assertEquals('x3a alert(1)', $result, 'Test for backtopage param'); + $this->assertEquals('x3aalert(1)', $result, 'Test for backtopage param'); return $result; }
    '; if ($module->type == 'pdf') { - $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; + $linkspec = ''.img_object($langs->trans("Preview"), 'pdf').''; } else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } @@ -780,7 +780,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; - print ''; + print ''; print "
    '; - print ''; + print ''; print "
    '; - print ''; + print ''; print '
    "; - print $obj->tva_intra; + print ''; if ($obj->tva_intra && !isValidVATID($companystatic)) { - print img_warning("BadVATNumber", '', ''); + print img_warning("BadVATNumber", '', 'pictofixedwidth'); } + print $obj->tva_intra; print "
    '.$langs->trans('Employee').''; - print ''; + print ''; //print $form->selectyesno("employee", (GETPOST('employee') != '' ?GETPOST('employee') : $defaultemployee), 1); print '
    '; - $doleditor = new DolEditor('WEBSITE_CSS_INLINE', $csscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_CSS_INLINE_x'), 'y'=>GETPOST('WEBSITE_CSS_INLINE_y')); + $doleditor = new DolEditor('WEBSITE_CSS_INLINE', $csscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, 'CSS', 'css'); print '
    '; - $doleditor = new DolEditor('WEBSITE_JS_INLINE', $jscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_JS_INLINE_x'), 'y'=>GETPOST('WEBSITE_JS_INLINE_y')); + $doleditor = new DolEditor('WEBSITE_JS_INLINE', $jscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, 'JS', 'javascript'); print '
    '; - $doleditor = new DolEditor('WEBSITE_HTML_HEADER', $htmlheadercontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_HTML_HEADER_x'), 'y'=>GETPOST('WEBSITE_HTML_HEADER_y')); + $doleditor = new DolEditor('WEBSITE_HTML_HEADER', $htmlheadercontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print '
    '; - $doleditor = new DolEditor('WEBSITE_ROBOT', $robotcontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_ROBOT_x'), 'y'=>GETPOST('WEBSITE_ROBOT_y')); + $doleditor = new DolEditor('WEBSITE_ROBOT', $robotcontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, 'Robot file', 'text'); print '
    '; - $doleditor = new DolEditor('WEBSITE_HTACCESS', $htaccesscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_HTACCESS_x'), 'y'=>GETPOST('WEBSITE_HTACCESS_y')); + $doleditor = new DolEditor('WEBSITE_HTACCESS', $htaccesscontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, $langs->trans("File").' .htaccess', 'text'); print '
    '; print $langs->trans("UseManifest").': '.$form->selectyesno('use_manifest', $website->use_manifest, 1).'
    '; - $doleditor = new DolEditor('WEBSITE_MANIFEST_JSON', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + + $poscursor = array('x'=>GETPOST('WEBSITE_MANIFEST_JSON_x'), 'y'=>GETPOST('WEBSITE_MANIFEST_JSON_y')); + $doleditor = new DolEditor('WEBSITE_MANIFEST_JSON', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text'); print '
    '; - $doleditor = new DolEditor('WEBSITE_README', $readmecontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $poscursor = array('x'=>GETPOST('WEBSITE_README_x'), 'y'=>GETPOST('WEBSITE_README_y')); + $doleditor = new DolEditor('WEBSITE_README', $readmecontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); print $doleditor->Create(1, '', true, $langs->trans("File").' README.md', 'text'); print '
    '; - $doleditor = new DolEditor('htmlheader', $pagehtmlheader, '', '120', 'ace', 'In', true, false, 'ace', ROWS_3, '100%', ''); + $poscursor = array('x'=>GETPOST('htmlheader_x'), 'y'=>GETPOST('htmlheader_y')); + $doleditor = new DolEditor('htmlheader', $pagehtmlheader, '', '120', 'ace', 'In', true, false, 'ace', ROWS_3, '100%', '', $poscursor); print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print '