';
print '| '.$i.' | ';
print ''.dol_print_date($db->jdate($objp->date), 'day').' | '; // Operation date
@@ -644,8 +657,6 @@ if ($action == 'new') {
print ''.price($objp->amount).' | ';
// Link to payment
print '';
- $paymentstatic->id = $objp->pid;
- $paymentstatic->ref = $objp->pref;
if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1);
} else {
@@ -654,8 +665,6 @@ if ($action == 'new') {
print ' | ';
// Link to bank transaction
print '';
- $accountlinestatic->id = $objp->rowid;
- $accountlinestatic->ref = $objp->ref;
if ($accountlinestatic->id > 0) {
print $accountlinestatic->getNomUrl(1);
} else {
@@ -665,10 +674,10 @@ if ($action == 'new') {
// Action button
print ' | ';
if ($object->statut == 0) {
- print 'id.'&action=remove&lineid='.$objp->rowid.'">'.img_delete().'';
+ print 'id.'&action=remove&token='.newToken().'&lineid='.$objp->rowid.'">'.img_delete().'';
}
if ($object->statut == 1 && $objp->statut != 2) {
- print 'id.'&action=reject_check&lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'';
+ print 'id.'&action=reject_check&token='.newToken().'&lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').'';
}
if ($objp->statut == 2) {
print ' '.img_picto($langs->trans('CheckRejected'), 'statut8').'';
@@ -724,11 +733,13 @@ print '';
if ($action != 'new') {
if ($object->statut == 1) {
- $filename = dol_sanitizeFileName($object->ref);
- $filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits');
+ // Documents
+ $objref = dol_sanitizeFileName($object->ref);
+ $filedir = $upload_dir.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
-
- print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1);
+ $genallowed = $usercancreate;
+ $delallowed = $usercandelete;
+ print $formfile->showdocuments('remisecheque', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
print ' ';
}
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index c66edfc8fe1..6b1053240c8 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -615,6 +615,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charseSupprimert_output = $outputlangs->charset_output;
+
$result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs);
if ($result > 0) {
//$outputlangs->charset_output=$sav_charset_output;
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 84d1b007e09..32edc0629bd 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -82,12 +82,12 @@ class Paiement extends CommonObject
public $paiementcode; // Code of payment.
/**
- * @var string type libelle
+ * @var string Type of payment label
*/
public $type_label;
/**
- * @var string type code
+ * @var string Type of payment code (seems duplicate with $paiementcode);
*/
public $type_code;
@@ -585,16 +585,19 @@ class Paiement extends CommonObject
return -1;
}
- $this->db->begin();
-
$this->fk_account = $accountid;
+ dol_syslog("addPaymentToBank ".$user->id.", ".$mode.", ".$label.", ".$this->fk_account.", ".$emetteur_nom.", ".$emetteur_banque);
+
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
- dol_syslog("$user->id, $mode, $label, $this->fk_account, $emetteur_nom, $emetteur_banque");
-
$acc = new Account($this->db);
$result = $acc->fetch($this->fk_account);
+ if ($result < 0) {
+ $error++;
+ return -1;
+ }
+
+ $this->db->begin();
$totalamount = $this->amount;
if (empty($totalamount)) {
@@ -951,6 +954,7 @@ class Paiement extends CommonObject
*
* @param string $filter Filter
* @return int|array <0 if KO or array of invoice id
+ * @see getAmountsArray()
*/
public function getBillsArray($filter = '')
{
@@ -984,6 +988,7 @@ class Paiement extends CommonObject
* Return list of amounts of payments.
*
* @return int|array Array of amount of payments
+ * @see getBillsArray()
*/
public function getAmountsArray()
{
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 6ed84de293c..7cd49a9427c 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -83,7 +83,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/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php
index 916a0bf5498..ce224735927 100644
--- a/htdocs/compta/paiement_vat.php
+++ b/htdocs/compta/paiement_vat.php
@@ -83,7 +83,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
}
}
- if ($amounts[key($amounts)] <= 0) {
+ if (empty($amounts[key($amounts)])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 6eac14d3eb3..0b419dacace 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -64,6 +64,7 @@ class BonPrelevement extends CommonObject
public $emetteur_numero_compte;
public $emetteur_code_banque;
public $emetteur_number_key;
+ public $sepa_xml_pti_in_ctti;
public $emetteur_iban;
public $emetteur_bic;
@@ -107,6 +108,7 @@ class BonPrelevement extends CommonObject
$this->emetteur_numero_compte = "";
$this->emetteur_code_banque = "";
$this->emetteur_number_key = "";
+ $this->sepa_xml_pti_in_ctti = false;
$this->emetteur_iban = "";
$this->emetteur_bic = "";
@@ -1038,10 +1040,11 @@ class BonPrelevement extends CommonObject
}
$account = new Account($this->db);
if ($account->fetch($id) > 0) {
- $this->emetteur_code_banque = $account->code_banque;
+ $this->emetteur_code_banque = $account->code_banque;
$this->emetteur_code_guichet = $account->code_guichet;
$this->emetteur_numero_compte = $account->number;
- $this->emetteur_number_key = $account->cle_rib;
+ $this->emetteur_number_key = $account->cle_rib;
+ $this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti;
$this->emetteur_iban = $account->iban;
$this->emetteur_bic = $account->bic;
@@ -1881,6 +1884,24 @@ class BonPrelevement extends CommonObject
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
$XML_CREDITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_CREDITOR .= ' '.$CrLf;
+ if ($this->sepa_xml_pti_in_ctti) {
+ $XML_CREDITOR .= ' ' . $CrLf;
+
+ // Can be 'NORM' for normal or 'HIGH' for high priority level
+ if (!empty($conf->global->PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY)) {
+ $instrprty = 'HIGH';
+ } else {
+ $instrprty = 'NORM';
+ }
+ $XML_CREDITOR .= ' '.$instrprty.'' . $CrLf;
+ $XML_CREDITOR .= ' ' . $CrLf;
+ $XML_CREDITOR .= ' SEPA' . $CrLf;
+ $XML_CREDITOR .= ' ' . $CrLf;
+ $XML_CREDITOR .= ' ' . $CrLf;
+ $XML_CREDITOR .= ' CORE' . $CrLf;
+ $XML_CREDITOR .= ' ' . $CrLf;
+ $XML_CREDITOR .= ' ' . $CrLf;
+ }
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.round($row_somme, 2).''.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
@@ -2031,6 +2052,7 @@ class BonPrelevement extends CommonObject
$this->emetteur_code_guichet = $account->code_guichet;
$this->emetteur_numero_compte = $account->number;
$this->emetteur_number_key = $account->cle_rib;
+ $this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti;
$this->emetteur_iban = $account->iban;
$this->emetteur_bic = $account->bic;
@@ -2125,17 +2147,17 @@ class BonPrelevement extends CommonObject
//$XML_SEPA_INFO .= ' False'.$CrLf;
$XML_SEPA_INFO .= ' '.$nombre.''.$CrLf;
$XML_SEPA_INFO .= ' '.$total.''.$CrLf;
- /*
- $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' SEPA'.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' TRF'.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' SECU'.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
- */
+ if (!$this->sepa_xml_pti_in_ctti) {
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ $XML_SEPA_INFO .= ' SEPA' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ $XML_SEPA_INFO .= ' CORE' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $format . '' . $CrLf;
+ $XML_SEPA_INFO .= ' ' . $CrLf;
+ }
$XML_SEPA_INFO .= ' '.dol_print_date($dateTime_ETAD, 'dayrfc').''.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).''.$CrLf;
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 342360bd454..30d4f4ce825 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -934,33 +934,29 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
if ($modecompta == 'CREANCES-DETTES') {
- //$column = 's.dateep'; // We use the date of salary
- $column = 'p.datep';
+ $column = 's.dateep'; // We use the date of end of period of salary
+
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
+ $sql .= " WHERE s.entity IN (".getEntity('salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm";
} else {
$column = 'p.datep';
- }
- $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
- $sql .= " WHERE s.entity IN (".getEntity('salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
+ $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
}
- $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
-
- // For backward compatibility with old module salary
- $column = 'p.datep';
- $sql .= " UNION ";
- $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
- $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
- }
- $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') {
@@ -975,7 +971,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql .= $db->order($newsortfield, $sortorder);
}
- dol_syslog("get payment salaries");
+ dol_syslog("get salaries");
$result = $db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 6aab9093c05..ff770acf554 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -615,23 +615,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
if ($modecompta == 'CREANCES-DETTES') {
- //$column = 's.dateep'; // we use the date of salary
- $column = 'p.datep';
+ $column = 's.dateep'; // we use the date of end of period of salary
+
+ $sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
+ $sql .= " WHERE s.entity IN (".getEntity('salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY s.label, dm";
}
if ($modecompta == "RECETTES-DEPENSES") {
$column = 'p.datep';
+
+ $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid";
+ $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY p.label, dm";
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
- $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p, ".MAIN_DB_PREFIX."salary as s";
- $sql .= " WHERE p.fk_salary = s.rowid";
- $sql .= " AND s.entity IN (".getEntity('salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
- }
- $sql .= " GROUP BY p.label, dm";
dol_syslog("get social salaries payments");
$result = $db->query($sql);
diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php
index 635531ab86b..c296d4037e5 100644
--- a/htdocs/compta/resultat/result.php
+++ b/htdocs/compta/resultat/result.php
@@ -334,7 +334,7 @@ if ($modecompta == 'CREANCES-DETTES') {
//var_dump($result);
//$r = $AccCat->calculate($result);
- $r = dol_eval($result, 1);
+ $r = dol_eval($result, 1, 1, '1');
//var_dump($r);
print ''.price($r).' | ';
@@ -353,7 +353,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$result = strtr($formula, $vars);
//$r = $AccCat->calculate($result);
- $r = dol_eval($result, 1);
+ $r = dol_eval($result, 1, 1, 1);
print ''.price($r).' | ';
$sommes[$code]['N'] += $r;
@@ -367,7 +367,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$result = strtr($formula, $vars);
//$r = $AccCat->calculate($result);
- $r = dol_eval($result, 1);
+ $r = dol_eval($result, 1, 1, 1);
print ''.price($r).' | ';
$sommes[$code]['M'][$k] += $r;
@@ -381,7 +381,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$result = strtr($formula, $vars);
//$r = $AccCat->calculate($result);
- $r = dol_eval($result, 1);
+ $r = dol_eval($result, 1, 1, 1);
print ''.price($r).' | ';
$sommes[$code]['M'][$k] += $r;
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index caa04146264..6419e2b8970 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -139,7 +139,7 @@ class ChargeSociales extends CommonObject
{
$sql = "SELECT cs.rowid, cs.date_ech";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
- $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user";
+ $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
$sql .= ", c.libelle as type_label";
$sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
@@ -172,6 +172,8 @@ class ChargeSociales extends CommonObject
$this->amount = $obj->amount;
$this->fk_project = $obj->fk_project;
$this->fk_user = $obj->fk_user;
+ $this->note_public = $obj->note_public;
+ $this->note_private = $obj->note_private;
$this->paye = $obj->paye;
$this->periode = $this->db->jdate($obj->periode);
$this->import_key = $this->import_key;
diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php
index 546a4c711d0..4c49a3008c6 100644
--- a/htdocs/compta/sociales/info.php
+++ b/htdocs/compta/sociales/info.php
@@ -81,7 +81,7 @@ $object->info($id);
$head = tax_prepare_head($object);
-print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, 'bill');
+print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
$morehtmlref = '';
// Label of social contribution
@@ -115,7 +115,7 @@ print ' ';
print ' ';
-print ' ';
+print '| ';
dol_print_object_info($object);
print ' | ';
diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php
new file mode 100644
index 00000000000..cf9d0cbdec5
--- /dev/null
+++ b/htdocs/compta/sociales/note.php
@@ -0,0 +1,135 @@
+
+ *
+ * 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/compta/sociales/note.php
+ * \ingroup tax
+ * \brief Tab for notes on Taxes
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+if (!empty($conf->projet->enabled)) {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+}
+
+// Load translation files required by the page
+$langs->loadLangs(array('compta', 'bills'));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+$object = new ChargeSociales($db);
+if ($id > 0) {
+ $object->fetch($id);
+}
+
+// Security check
+$socid = GETPOST('socid', 'int');
+if ($user->socid) {
+ $socid = $user->socid;
+}
+$result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
+
+$permissiontoread = $user->rights->tax->charges->lire;
+$permissiontoadd = $user->rights->tax->charges->creer;
+$permissionnote = $user->rights->tax->charges->creer; // Used by the include of actions_setnotes.inc.php
+
+
+/*
+ * Actions
+ */
+
+$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)) {
+ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
+}
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$title = $langs->trans("SocialContribution").' - '.$langs->trans("Note");
+$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
+llxHeader('', $title, $help_url);
+
+if ($id > 0 || !empty($ref)) {
+ $object->fetch_thirdparty();
+
+ $head = tax_prepare_head($object);
+
+ print dol_get_fiche_head($head, 'note', $langs->trans("SocialContribution"), -1, $object->picto);
+
+ $morehtmlref = '';
+ // Label of social contribution
+ $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
+ $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
+ // Project
+ if (!empty($conf->projet->enabled)) {
+ $langs->load("projects");
+ $morehtmlref .= ' '.$langs->trans('Project').' : ';
+ if (!empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ if ($proj->title) {
+ $morehtmlref .= ' - '.dol_escape_htmltag($proj->title);
+ }
+ } else {
+ $morehtmlref .= '';
+ }
+ }
+ $morehtmlref .= ' ';
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ //$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+
+ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
+
+
+ print '';
+ print ' ';
+
+
+ $cssclass = "titlefield";
+ include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
+
+ print ' ';
+
+ print dol_get_fiche_end();
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index 317838009c7..538b561e7fe 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -468,7 +468,7 @@ if ($action == 'create') {
} else {
$label = $langs->trans("VATPayment");
}
- print ' | | '.$langs->trans("Label").' | | ';
+ print '| '.$langs->trans("Label").' | | ';
print '| '.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).' | ';
print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1);
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index abc89ecc1eb..87d6b98475b 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -534,9 +534,9 @@ if (empty($reshook)) {
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
// ajout prix achat
- $fk_fournprice = $_POST['fournprice'];
- if (!empty($_POST['buying_price'])) {
- $pa_ht = $_POST['buying_price'];
+ $fk_fournprice = GETPOST('fournprice');
+ if (GETPOST('buying_price')) {
+ $pa_ht = GETPOST('buying_price');
} else {
$pa_ht = null;
}
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index f2fc588348d..4e4437c1b2c 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2591,7 +2591,6 @@ class ContratLigne extends CommonObjectLine
*/
public $table_element = 'contratdet';
-
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea()
*/
diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php
index cdbda7a17b8..5297026d5d3 100644
--- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php
@@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
}
-print "\n";
+print "\n";
global $user;
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 602897d34f9..5a4ec3bf02f 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -143,7 +143,7 @@ if (!$error && $massaction == 'confirm_presend') {
$massaction = 'presend';
}
- $receiver = $_POST['receiver'];
+ $receiver = GETPOST('receiver', 'alphawithlgt');
if (!is_array($receiver)) {
if (empty($receiver) || $receiver == '-1') {
$receiver = array();
@@ -181,7 +181,7 @@ if (!$error && $massaction == 'confirm_presend') {
$tmparray = array();
if (trim($_POST['sendto'])) {
// Recipients are provided into free text
- $tmparray[] = trim($_POST['sendto']);
+ $tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
if (count($receiver) > 0) {
foreach ($receiver as $key => $val) {
@@ -197,7 +197,7 @@ if (!$error && $massaction == 'confirm_presend') {
$sendto = implode(',', $tmparray);
// Define $sendtocc
- $receivercc = $_POST['receivercc'];
+ $receivercc = GETPOST('receivercc', 'alphawithlgt');
if (!is_array($receivercc)) {
if ($receivercc == '-1') {
$receivercc = array();
@@ -207,7 +207,7 @@ if (!$error && $massaction == 'confirm_presend') {
}
$tmparray = array();
if (trim($_POST['sendtocc'])) {
- $tmparray[] = trim($_POST['sendtocc']);
+ $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
if (count($receivercc) > 0) {
foreach ($receivercc as $key => $val) {
@@ -298,7 +298,7 @@ if (!$error && $massaction == 'confirm_presend') {
continue;
}
- if ($_POST['addmaindocfile']) {
+ if (GETPOST('addmaindocfile')) {
// TODO Use future field $objectobj->fullpathdoc to know where is stored default file
// TODO If not defined, use $objectobj->model_pdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename = dol_sanitizeFileName($objectobj->ref).'.pdf';
@@ -347,7 +347,7 @@ if (!$error && $massaction == 'confirm_presend') {
$reg = array();
$fromtype = GETPOST('fromtype');
if ($fromtype === 'user') {
- $from = $user->getFullName($langs).' <'.$user->email.'>';
+ $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
} elseif ($fromtype === 'company') {
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
@@ -361,10 +361,10 @@ if (!$error && $massaction == 'confirm_presend') {
$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 = GETPOST('fromname').' <'.GETPOST('frommail').'>';
}
$replyto = $from;
@@ -1579,17 +1579,20 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
- if ($result>0) {
- if ($objecttmp->statut == Holiday::STATUS_VALIDATED && $user->id == $objecttmp->fk_validator) {
+ if ($result > 0) {
+ if ($objecttmp->statut != Holiday::STATUS_VALIDATED) {
+ setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $langs->transnoentitiesnoconv('Validated')), null, 'warnings');
+ continue;
+ }
+ if ($user->id == $objecttmp->fk_validator) {
$objecttmp->oldcopy = dol_clone($objecttmp);
$objecttmp->date_valid = dol_now();
$objecttmp->fk_user_valid = $user->id;
$objecttmp->statut = Holiday::STATUS_APPROVED;
- $db->begin();
-
$verif = $objecttmp->approve($user);
+
if ($verif <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
@@ -1664,14 +1667,9 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
}
}
}
-
- if (!$error) {
- $db->commit();
- $nbok++;
- } else {
- $db->rollback();
- $action = '';
- }
+ } else {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorNotApproverForHoliday', $objecttmp->ref), null, 'errors');
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
@@ -1683,7 +1681,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsApproved", $nbok), null, 'mesgs');
- } else {
+ } elseif ($nbok == 1) {
setEventMessages($langs->trans("RecordAproved"), null, 'mesgs');
}
$db->commit();
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index 55416354441..d31f8d60dfc 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -49,7 +49,7 @@ if (GETPOST('addfile', 'alpha')) {
/*
* Remove file in email form
*/
-if (!empty($_POST['removedfile']) && empty($_POST['removAll'])) {
+if (GETPOST('removedfile') && !GETPOST('removAll')) {
$trackid = GETPOST('trackid', 'aZ09');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -103,7 +103,7 @@ if (GETPOST('removAll', 'alpha')) {
/*
* Send mail
*/
-if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST['removAll'] && !$_POST['removedfile'] && !$_POST['cancel'] && !$_POST['modelselected']) {
+if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) {
if (empty($trackid)) {
$trackid = GETPOST('trackid', 'aZ09');
}
@@ -171,7 +171,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$sendtoccuserid = array();
// Define $sendto
- $receiver = $_POST['receiver'];
+ $receiver = GETPOST('receiver', 'alphawithlgt');
if (!is_array($receiver)) {
if ($receiver == '-1') {
$receiver = array();
@@ -183,12 +183,12 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$tmparray = array();
if (trim($_POST['sendto'])) {
// Recipients are provided into free text field
- $tmparray[] = trim($_POST['sendto']);
+ $tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
}
if (trim($_POST['tomail'])) {
// Recipients are provided into free hidden text field
- $tmparray[] = trim($_POST['tomail']);
+ $tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
}
if (count($receiver) > 0) {
@@ -207,7 +207,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
}
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
- $receiveruser = $_POST['receiveruser'];
+ $receiveruser = GETPOST('receiveruser', 'alphawithlgt');
if (is_array($receiveruser) && count($receiveruser) > 0) {
$fuserdest = new User($db);
foreach ($receiveruser as $key => $val) {
@@ -220,7 +220,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$sendto = implode(',', $tmparray);
// Define $sendtocc
- $receivercc = $_POST['receivercc'];
+ $receivercc = GETPOST('receivercc', 'alphawithlgt');
if (!is_array($receivercc)) {
if ($receivercc == '-1') {
$receivercc = array();
@@ -230,7 +230,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
}
$tmparray = array();
if (trim($_POST['sendtocc'])) {
- $tmparray[] = trim($_POST['sendtocc']);
+ $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
}
if (count($receivercc) > 0) {
foreach ($receivercc as $key => $val) {
@@ -248,7 +248,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
}
}
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
- $receiverccuser = $_POST['receiverccuser'];
+ $receiverccuser = GETPOST('receiverccuser', 'alphawithlgt');
if (is_array($receiverccuser) && count($receiverccuser) > 0) {
$fuserdest = new User($db);
@@ -293,10 +293,10 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
}
} else {
- $from = dol_string_nospecial($_POST['fromname'], ' ', array(",")).' <'.$_POST['frommail'].'>';
+ $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>';
}
- $replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")).' <'.$_POST['replytomail'].'>';
+ $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>';
$message = GETPOST('message', 'restricthtml');
$subject = GETPOST('subject', 'restricthtml');
@@ -313,7 +313,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "").$conf->global->$autocopy));
}
- $deliveryreceipt = $_POST['deliveryreceipt'];
+ $deliveryreceipt = GETPOST('deliveryreceipt');
if ($action == 'send' || $action == 'relance') {
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php
index 19c389ec7f8..7daa715bbb9 100644
--- a/htdocs/core/ajax/ajaxdirtree.php
+++ b/htdocs/core/ajax/ajaxdirtree.php
@@ -47,8 +47,6 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
- //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = '/bbb/'; }
-
$openeddir = GETPOST('openeddir');
$modulepart = GETPOST('modulepart');
$selecteddir = jsUnEscape(GETPOST('dir')); // relative path. We must decode using same encoding function used by javascript: escape()
@@ -60,7 +58,6 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call
}
} else {
// For no ajax call
- //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = GETPOST('preopened'); }
$openeddir = GETPOST('openeddir');
$modulepart = GETPOST('modulepart');
diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php
index 9853faa8585..97a74e74916 100644
--- a/htdocs/core/ajax/row.php
+++ b/htdocs/core/ajax/row.php
@@ -81,8 +81,6 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) {
$perm = 1;
- } elseif ($table_element_line == 'ecm_files' && $user->rights->ecm->creer) {
- $perm = 1;
} elseif ($table_element_line == 'emailcollector_emailcollectoraction' && $user->admin) {
$perm = 1;
} elseif ($table_element_line == 'bom_bomline' && $user->rights->bom->write) {
@@ -97,10 +95,18 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'facture_fourn_det_rec' && $user->rights->fournisseur->facture->creer) {
$perm = 1;
- } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
- $perm = 1;
- } elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
- $perm = 1;
+ } elseif ($table_element_line == 'ecm_files') { // Used when of page "documents.php"
+ if (!empty($user->rights->ecm->creer)) {
+ $perm = 1;
+ } elseif ($fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
+ $perm = 1;
+ } elseif ($fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
+ $perm = 1;
+ } elseif ($fk_element == 'fk_holiday' && !empty($user->rights->holiday->write)) {
+ $perm = 1;
+ } elseif ($fk_element == 'fk_soc' && !empty($user->rights->societe->creer)) {
+ $perm = 1;
+ }
} elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php
index 2f88cebf58b..05fad8148fa 100644
--- a/htdocs/core/ajax/saveinplace.php
+++ b/htdocs/core/ajax/saveinplace.php
@@ -103,6 +103,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e
}
$_POST['action'] = 'update'; // Hack so restrictarea will test permissions on write too
+
$feature = $newelement;
$feature2 = $subelement;
$object_id = $fk_element;
diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
index 2ce9444f677..5c8bd2c8555 100644
--- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
+++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
@@ -87,11 +87,11 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
$param_day = 'DOLUSERCOOKIE_ticket_last_days';
- if (!empty($_POST[$param_day])) {
- if ($_POST[$param_day] >= 15) {
+ if (GETPOST($param_day)) {
+ if (GETPOST($param_day) >= 15) {
$days = 14;
} else {
- $days = $_POST[$param_day];
+ $days = GETPOST($param_day);
}
} else {
$days = 7;
diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php
index 94695034cce..f2195659654 100644
--- a/htdocs/core/boxes/box_scheduled_jobs.php
+++ b/htdocs/core/boxes/box_scheduled_jobs.php
@@ -102,7 +102,7 @@ class box_scheduled_jobs extends ModeleBoxes
while ($i < $num) {
$objp = $this->db->fetch_object($result);
- if (dol_eval($objp->test, 1, 1)) {
+ if (dol_eval($objp->test, 1, 1, '')) {
$nextrun = $this->db->jdate($objp->datenextrun);
if (empty($nextrun)) {
$nextrun = $this->db->jdate($objp->datestart);
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index a8986475095..8030c2f58ec 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -149,31 +149,7 @@ class CMailFile
}
}
- // Add autocopy to if not already in $to (Note: Adding bcc for specific modules are also done from pages)
- if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && !preg_match('/'.preg_quote($conf->global->MAIN_MAIL_AUTOCOPY_TO, '/').'/i', $to)) {
- $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
- }
-
- $this->subject = $subject;
- $this->addr_to = $to;
- $this->addr_from = $from;
- $this->msg = $msg;
- $this->filename_list = $filename_list;
- $this->mimetype_list = $mimetype_list;
- $this->mimefilename_list = $mimefilename_list;
- $this->addr_cc = $addr_cc;
- $this->addr_bcc = $addr_bcc;
- $this->deliveryreceipt = $deliveryreceipt;
- if (empty($replyto)) {
- $replyto = $from;
- }
- $this->reply_to = $replyto;
- $this->errors_to = $errors_to;
- $this->trackid = $trackid;
$this->sendcontext = $sendcontext;
- $this->filename_list = $filename_list;
- $this->mimetype_list = $mimetype_list;
- $this->mimefilename_list = $mimefilename_list;
// Define this->sendmode
$this->sendmode = '';
@@ -186,10 +162,7 @@ class CMailFile
}
}
if (empty($this->sendmode)) {
- $this->sendmode = $conf->global->MAIN_MAIL_SENDMODE;
- }
- if (empty($this->sendmode)) {
- $this->sendmode = 'mail';
+ $this->sendmode = (!empty($conf->global->MAIN_MAIL_SENDMODE) ? $conf->global->MAIN_MAIL_SENDMODE : 'mail');
}
// We define end of line (RFC 821).
@@ -283,15 +256,25 @@ class CMailFile
$addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
}
+ $this->subject = $subject;
$this->addr_to = $to;
+ $this->addr_from = $from;
+ $this->msg = $msg;
+ $this->filename_list = $filename_list;
+ $this->mimetype_list = $mimetype_list;
+ $this->mimefilename_list = $mimefilename_list;
$this->addr_cc = $addr_cc;
$this->addr_bcc = $addr_bcc;
- $this->reply_to = $replyto;
- $this->addr_from = $from;
- $this->subject = $subject;
- $this->errors_to = $errors_to;
$this->deliveryreceipt = $deliveryreceipt;
+ if (empty($replyto)) {
+ $replyto = $from;
+ }
+ $this->reply_to = $replyto;
+ $this->errors_to = $errors_to;
$this->trackid = $trackid;
+ $this->filename_list = $filename_list;
+ $this->mimetype_list = $mimetype_list;
+ $this->mimefilename_list = $mimefilename_list;
if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 80fe8b95e5f..5e67d293e3d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -7,7 +7,7 @@
* Copyright (C) 2012-2015 Marcos GarcÃa
* Copyright (C) 2012-2015 Raphaël Doursenaud
* Copyright (C) 2012 Cedric Salvador
- * Copyright (C) 2015-2021 Alexandre Spangaro
+ * Copyright (C) 2015-2022 Alexandre Spangaro
* Copyright (C) 2016 Bahfir abbes
* Copyright (C) 2017 ATM Consulting
* Copyright (C) 2017-2019 Nicolas ZABOURI
@@ -3675,7 +3675,7 @@ abstract class CommonObject
// Elements of the core modules which have `$module` property but may to which we don't want to prefix module part to the element name for finding the linked object in llx_element_element.
// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
- $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization');
+ $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
// Add module part to target type if object has $module property and isn't in core modules.
$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
@@ -5693,12 +5693,12 @@ abstract class CommonObject
$enabled = 1;
if (isset($this->fields[$key]['enabled'])) {
- $enabled = dol_eval($this->fields[$key]['enabled'], 1);
+ $enabled = dol_eval($this->fields[$key]['enabled'], 1, 1, '1');
}
/*$perms = 1;
if (isset($this->fields[$key]['perms']))
{
- $perms = dol_eval($this->fields[$key]['perms'], 1);
+ $perms = dol_eval($this->fields[$key]['perms'], 1, 1, '1');
}*/
if (empty($enabled)) {
continue;
@@ -5708,11 +5708,11 @@ abstract class CommonObject
if (in_array($key_type, array('date'))) {
// Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
- $value_key = dol_mktime(0, 0, 0, $_POST[$postfieldkey."month"], $_POST[$postfieldkey."day"], $_POST[$postfieldkey."year"]);
+ $value_key = dol_mktime(0, 0, 0, GETPOST($postfieldkey."month", 'int'), GETPOST($postfieldkey."day", 'int'), GETPOST($postfieldkey."year", 'int'));
} elseif (in_array($key_type, array('datetime'))) {
// Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
- $value_key = dol_mktime($_POST[$postfieldkey."hour"], $_POST[$postfieldkey."min"], 0, $_POST[$postfieldkey."month"], $_POST[$postfieldkey."day"], $_POST[$postfieldkey."year"]);
+ $value_key = dol_mktime(GETPOST($postfieldkey."hour", 'int'), GETPOST($postfieldkey."min", 'int'), 0, GETPOST($postfieldkey."month", 'int'), GETPOST($postfieldkey."day", 'int'), GETPOST($postfieldkey."year", 'int'));
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
$value_arr = GETPOST($postfieldkey, 'array'); // check if an array
if (!empty($value_arr)) {
@@ -5854,7 +5854,7 @@ abstract class CommonObject
if (!empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
- $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0);
+ $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
}
}
}
@@ -5985,7 +5985,7 @@ abstract class CommonObject
if (!empty($attrfieldcomputed)) {
if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) {
- $value = dol_eval($attrfieldcomputed, 1, 0);
+ $value = dol_eval($attrfieldcomputed, 1, 0, '');
dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG);
$new_array_options[$key] = $value;
} else {
@@ -6352,7 +6352,7 @@ abstract class CommonObject
if (!empty($attrfieldcomputed)) {
if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) {
- $value = dol_eval($attrfieldcomputed, 1, 0);
+ $value = dol_eval($attrfieldcomputed, 1, 0, '');
dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG);
$this->array_options["options_".$key] = $value;
} else {
@@ -6697,7 +6697,7 @@ abstract class CommonObject
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%');
- $out = $doleditor->Create(1);
+ $out = $doleditor->Create(1, '', true, '', '', $moreparam, $morecss);
} else {
$out = '';
}
@@ -7206,7 +7206,7 @@ abstract class CommonObject
if ($computed) {
// Make the eval of compute string
//var_dump($computed);
- $value = dol_eval($computed, 1, 0);
+ $value = dol_eval($computed, 1, 0, '');
}
if (empty($morecss)) {
@@ -7717,7 +7717,7 @@ abstract class CommonObject
if (empty($reshook)) {
if (key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) {
$out .= "\n";
- $out .= ' ';
+ $out .= ' ';
$out .= "\n";
$extrafields_collapse_num = '';
@@ -7731,7 +7731,7 @@ abstract class CommonObject
// Test on 'enabled' ('enabled' is different than 'list' = 'visibility')
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) {
- $enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1);
+ $enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '1');
}
if (empty($enabled)) {
continue;
@@ -7739,12 +7739,12 @@ abstract class CommonObject
$visibility = 1;
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key])) {
- $visibility = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1);
+ $visibility = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '1');
}
$perms = 1;
if ($perms && isset($extrafields->attributes[$this->table_element]['perms'][$key])) {
- $perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1);
+ $perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '1');
}
if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) {
diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php
index 487482a9b3c..74bab57c605 100644
--- a/htdocs/core/class/commonobjectline.class.php
+++ b/htdocs/core/class/commonobjectline.class.php
@@ -45,6 +45,11 @@ abstract class CommonObjectLine extends CommonObject
*/
public $rowid;
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto = 'line';
+
/**
* Product/service unit code ('km', 'm', 'p', ...)
* @var string
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index c7d01cab586..f59441eb8d4 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -165,7 +165,7 @@ class Conf
/**
* Load setup values into conf object (read llx_const) for a specified entity
- * Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
+ * Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setEntityValues is called.
*
* @param DoliDB $db Database handler
* @param int $entity Entity to get
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index da98719d828..4a2e65ba1f3 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -44,6 +44,8 @@ class DolEditor
public $height;
public $width;
public $readonly;
+ public $posx;
+ public $posy;
/**
@@ -64,8 +66,9 @@ class DolEditor
* @param int $rows Size of rows for textarea tool
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
* @param int $readonly 0=Read/Edit, 1=Read only
+ * @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y)
*/
- public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0)
+ public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
{
global $conf, $langs;
@@ -106,8 +109,10 @@ class DolEditor
$this->toolbarstartexpanded = $toolbarstartexpanded;
$this->rows = max(ROWS_3, $rows);
$this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
- $this->height = $height;
+ $this->height = $height;
$this->width = $width;
+ $this->posx = empty($poscursor['x']) ? 0 : $poscursor['x'];
+ $this->posy = empty($poscursor['y']) ? 0 : $poscursor['y'];
}
}
@@ -121,9 +126,11 @@ class DolEditor
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...)
+ * @param string $moreparam Add extra tags to the textarea
+ * @param string $morecss Add extra css to the textarea
* @return void|string
*/
- public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '')
+ public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '')
{
// phpcs:enable
global $conf, $langs;
@@ -141,7 +148,7 @@ class DolEditor
//$out.= ' | '."\n";
@@ -5199,6 +5202,7 @@ class Form
$out .= '';
$out .= '';
} else {
+ $out .= '';
if ($selected) {
$projet = new Project($this->db);
$projet->fetch($selected);
@@ -5206,6 +5210,7 @@ class Form
} else {
$out .= " ";
}
+ $out .= '';
}
if (empty($nooutput)) {
@@ -6675,7 +6680,7 @@ class Form
// phpcs:enable
global $langs;
- $retstring = '';
+ $retstring = '';
$hourSelected = 0;
$minSelected = 0;
@@ -6707,7 +6712,7 @@ class Form
if ($typehour != 'text') {
$retstring .= ' '.$langs->trans('HourShort');
} else {
- $retstring .= ':';
+ $retstring .= ':';
}
// Minutes
@@ -6735,7 +6740,7 @@ class Form
$retstring .= ' '.$langs->trans('MinuteShort');
}
- //$retstring.=" ";
+ $retstring.="";
if (!empty($nooutput)) {
return $retstring;
@@ -7522,7 +7527,7 @@ class Form
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...)
$tmpfieldstoshow = '';
foreach ($objecttmp->fields as $key => $val) {
- if (!dol_eval($val['enabled'], 1, 1)) {
+ if (!dol_eval($val['enabled'], 1, 1, 1, '1')) {
continue;
}
if (!empty($val['showoncombobox'])) {
@@ -8123,12 +8128,9 @@ class Form
$out .= "\n".'';
+ }
return $out;
}
diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php
index 518a8f93290..1a2c02deb54 100644
--- a/htdocs/core/class/html.formcategory.class.php
+++ b/htdocs/core/class/html.formcategory.class.php
@@ -49,13 +49,13 @@ class FormCategory extends Form
$categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1);
$categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -";
- $tmptitle = $langs->trans("Category");
+ $tmptitle = $langs->transnoentitiesnoconv("Category");
$filter = '';
$filter .= '';
$filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
//$filter .= $langs->trans('Categories').": ";
- $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle);
+ $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300 widthcentpercentminusx", 0, 0, '', '', $tmptitle);
$filter .= " ";
return $filter;
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 217bba55330..d8801d00dc7 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -360,8 +360,8 @@ class FormFile
* This also set the property $this->numoffiles
*
* @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...)
- * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
- * @param string $filedir Directory to scan
+ * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module.
+ * @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234'
* @param string $urlsource Url of origin page (for return)
* @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0)
@@ -1283,12 +1283,22 @@ class FormFile
}
print ' | ';
print ' | ';
- if (!$disablemove) {
+ if (empty($disablemove) && count($filearray) > 1) {
print ' | ';
}
print "\n";
}
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($filearray, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $filearray = dol_sort_array($filearray, $sortfield, $sortorder);
+ }
+ }
+
print '';
//print $url.' sortfield='.$sortfield.' sortorder='.$sortorder;
print_liste_field_titre('Documents2', $url, "name", "", $param, '', $sortfield, $sortorder, 'left ');
@@ -1301,21 +1311,11 @@ class FormFile
print_liste_field_titre('');
// Action button
print_liste_field_titre('');
- if (!$disablemove) {
+ if (empty($disablemove) && count($filearray) > 1) {
print_liste_field_titre('');
}
print " \n";
- // Get list of files stored into database for same relative directory
- if ($relativedir) {
- completeFileArrayWithDatabaseInfo($filearray, $relativedir);
-
- //var_dump($sortfield.' - '.$sortorder);
- if ($sortfield && $sortorder) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
- $filearray = dol_sort_array($filearray, $sortfield, $sortorder);
- }
- }
-
$nboffiles = count($filearray);
if ($nboffiles > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
@@ -1510,18 +1510,18 @@ class FormFile
}
print "";
- if (empty($disablemove)) {
+ if (empty($disablemove) && count($filearray) > 1) {
if ($nboffiles > 1 && $conf->browser->layout != 'phone') {
print '';
if ($i > 0) {
print 'id.'&action=up&rowid='.$line->id.'">'.img_up('default', 0, 'imgupforline').'';
}
- if ($i < $nboffiles - 1) {
+ if ($i < ($nboffiles - 1)) {
print 'id.'&action=down&rowid='.$line->id.'">'.img_down('default', 0, 'imgdownforline').'';
}
print ' | ';
} else {
- print 'browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>';
+ print ' | browser->layout != 'phone') ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>';
print ' | ';
}
}
@@ -1531,7 +1531,7 @@ class FormFile
print '';
print '';
print '';
- if (empty($disablemove)) {
+ if (empty($disablemove) && count($filearray) > 1) {
print ' | ';
}
}
@@ -1542,7 +1542,7 @@ class FormFile
}
if ($nboffiles == 0) {
$colspan = '6';
- if (empty($disablemove)) {
+ if (empty($disablemove) && count($filearray) > 1) {
$colspan++; // 6 columns or 7
}
print '| ';
@@ -2032,7 +2032,7 @@ class FormFile
print ' | ";
diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
index 3f728d99567..e9ec8accf30 100644
--- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
@@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
}
-print "\n";
+print "\n";
global $user;
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..a9bfe8ab4f2 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
@@ -1083,7 +1083,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (empty($include_users)) {
print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
} else {
- $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // Will work only if supervisor has permission to approve so is inside include_users
+ // Defined default approver (the forced approved of user or the supervisor if no forced value defined)
+ // Note: This use will be set only if the deinfed approvr has permission to approve so is inside include_users
+ $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
$defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver
}
@@ -1414,7 +1416,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/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php
index 5e8124fe09a..8050eb08ec9 100644
--- a/htdocs/hrm/class/evaluation.class.php
+++ b/htdocs/hrm/class/evaluation.class.php
@@ -1067,79 +1067,4 @@ class Evaluation extends CommonObject
return $error;
}
-
- /**
- * @param string $action
- * @param int $selected
- */
- // public function printObjectLines($action, $selected = 0)
- // {
- // global $conf, $hookmanager, $langs, $user, $extrafields, $object;
- // // TODO We should not use global var for this
- // global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax;
- //
- // // Define usemargins
- //// $usemargins = 0;
- //// if (!empty($conf->margin->enabled) && !empty($this->element) && in_array($this->element, array('facture', 'facturerec', 'propal', 'commande'))) {
- //// $usemargins = 1;
- //// }
- //
- // $num = count($this->lines);
- //
- // // Line extrafield
- // if (!is_object($extrafields)) {
- // require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
- // $extrafields = new ExtraFields($this->db);
- // }
- // $extrafields->fetch_name_optionals_label($this->table_element_line);
- //
- // $parameters = array('num'=>$num, 'selected'=>$selected, 'table_element_line'=>$this->table_element_line);
- // $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- // if (empty($reshook)) {
- // // Output template part (modules that overwrite templates must declare this into descriptor)
- // // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook.
- // include dol_buildpath('hrm/core/tpl/objectline_title.tpl.php');
- // }
- //
- // $i = 0;
- //
- // print " \n";
- // foreach ($this->lines as $line) {
- // //Line extrafield
- // $line->fetch_optionals();
- //
- // //if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
- // if (is_object($hookmanager)) { // Old code is commented on preceding line.
- // if (empty($line->fk_parent_line)) {
- // $parameters = array('line'=>$line, 'num'=>$num, 'i'=>$i, 'selected'=>$selected, 'table_element_line'=>$line->table_element);
- // $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- // } else {
- // $parameters = array('line'=>$line, 'num'=>$num, 'i'=>$i, 'selected'=>$selected, 'table_element_line'=>$line->table_element, 'fk_parent_line'=>$line->fk_parent_line);
- // $reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- // }
- // }
- // if (empty($reshook)) {
- // $this->printObjectLine($action, $line);
- // }
- //
- // $i++;
- // }
- // print "\n";
- // }
-
- // public function printObjectLine($action, $line)
- // {
- // global $conf, $langs, $user, $object, $hookmanager;
- // global $form;
- // global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
- //
- // $object_rights = $this->getRights();
- //
- // $element = $this->element;
- //
- // $text = '';
- // $description = '';
- //
- // include dol_buildpath('hrm/tpl/objectline_view.tpl.php');
- // }
}
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/evaluation_list.php b/htdocs/hrm/evaluation_list.php
index 35189f11b87..ad99573b096 100644
--- a/htdocs/hrm/evaluation_list.php
+++ b/htdocs/hrm/evaluation_list.php
@@ -114,11 +114,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
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/job_list.php b/htdocs/hrm/job_list.php
index 55363d729b5..7644ea1fd0f 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -114,11 +114,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php
index d36d352e895..86167ef4024 100644
--- a/htdocs/hrm/position.php
+++ b/htdocs/hrm/position.php
@@ -357,11 +357,11 @@ function DisplayPositionList()
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.' . $key] = array(
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
- 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
@@ -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 1585ed1e03f..13315a2a9bc 100644
--- a/htdocs/hrm/position_list.php
+++ b/htdocs/hrm/position_list.php
@@ -114,11 +114,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php
index a06cf40952a..e1144f75866 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
@@ -538,11 +535,11 @@ if ($action != "create" && $action != "edit") {
foreach ($objectline->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.' . $key] = array(
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
- 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position' => $val['position'],
'help' => isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php
index 1fc5440e589..8ef800b3ffc 100644
--- a/htdocs/hrm/skill_list.php
+++ b/htdocs/hrm/skill_list.php
@@ -114,11 +114,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
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('/ ';
+
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 '';
+
+ 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 ' | ';
+}
+
/* 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 ''."\n";
// Common attributes
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index 675f6e4397f..feadd8d9800 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -124,11 +124,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index a44c819aa78..fd5ff8461fe 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -219,12 +219,12 @@ ByPredefinedAccountGroups=By predefined groups
ByPersonalizedAccountGroups=By personalized groups
ByYear=By year
NotMatch=Not Set
-DeleteMvt=Delete some operation lines from accounting
+DeleteMvt=Delete some lines from accounting
DelMonth=Month to delete
DelYear=Year to delete
DelJournal=Journal to delete
-ConfirmDeleteMvt=This will delete all operation lines of the accounting for the year/month and/or for a specific journal (At least one criterion is required). You will have to reuse the feature '%s' to have the deleted record back in the ledger.
-ConfirmDeleteMvtPartial=This will delete the transaction from the accounting (all operation lines related to the same transaction will be deleted)
+ConfirmDeleteMvt=This will delete all lines in accountancy for the year/month and/or for a specific journal (At least one criterion is required). You will have to reuse the feature '%s' to have the deleted record back in the ledger.
+ConfirmDeleteMvtPartial=This will delete the transaction from the accounting (all lines related to the same transaction will be deleted)
FinanceJournal=Finance journal
ExpenseReportsJournal=Expense reports journal
DescFinanceJournal=Finance journal including all the types of payments by bank account
@@ -282,7 +282,7 @@ DescClosure=Consult here the number of movements by month who are not validated
OverviewOfMovementsNotValidated=Step 1/ Overview of movements not validated. (Necessary to close a fiscal year)
AllMovementsWereRecordedAsValidated=All movements were recorded as validated
NotAllMovementsCouldBeRecordedAsValidated=Not all movements could be recorded as validated
-ValidateMovements=Validate movements
+ValidateMovements=Validate and lock record...
DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible
ValidateHistory=Bind Automatically
@@ -301,7 +301,7 @@ Accounted=Accounted in ledger
NotYetAccounted=Not yet transferred to accounting
ShowTutorial=Show Tutorial
NotReconciled=Not reconciled
-WarningRecordWithoutSubledgerAreExcluded=Warning, all operations without subledger account defined are filtered and excluded from this view
+WarningRecordWithoutSubledgerAreExcluded=Warning, all lines without subledger account defined are filtered and excluded from this view
## Admin
BindingOptions=Binding options
@@ -329,8 +329,9 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc
ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting)
## Export
-NotifiedExportDate=Flag exported lines as exported (modification of the lines will not be possible)
-NotifiedValidationDate=Validate the exported entries (modification or deletion of the lines will not be possible)
+NotifiedExportDate=Flag exported lines as Exported (to modify a line, you will need to delete the whole transaction and re-transfert it into accounting)
+NotifiedValidationDate=Validate and Lock the exported entries (same effect than the "Closure" feature, modification and deletion of the lines will DEFINITELY not be possible)
+DateValidationAndLock=Date validation and lock
ConfirmExportFile=Confirmation of the generation of the accounting export file ?
ExportDraftJournal=Export draft journal
Modelcsv=Model of export
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 1e94ecbfdf0..cffd3532c05 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1068,6 +1068,7 @@ DictionaryExpenseTaxCat=Expense report - Transportation categories
DictionaryExpenseTaxRange=Expense report - Range by transportation category
DictionaryTransportMode=Intracomm report - Transport mode
DictionaryBatchStatus=Product lot/serial Quality Control status
+DictionaryAssetDisposalType=Type of disposal of assets
TypeOfUnit=Type of unit
SetupSaved=Setup saved
SetupNotSaved=Setup not saved
@@ -2222,4 +2223,5 @@ 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
\ No newline at end of file
+TemplateforBusinessCards=Template for a business card in different size
+InventorySetup= Inventory Setup
diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang
index afafc98503f..d1d47b96f63 100644
--- a/htdocs/langs/en_US/assets.lang
+++ b/htdocs/langs/en_US/assets.lang
@@ -1,4 +1,4 @@
-# Copyright (C) 2018 Alexandre Spangaro
+# Copyright (C) 2018-2022 Alexandre Spangaro
#
# 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
@@ -16,52 +16,171 @@
#
# Generic
#
-Assets = Assets
-NewAsset = New asset
-AccountancyCodeAsset = Accounting code (asset)
-AccountancyCodeDepreciationAsset = Accounting code (depreciation asset account)
-AccountancyCodeDepreciationExpense = Accounting code (depreciation expense account)
-NewAssetType=New asset type
-AssetsTypeSetup=Asset type setup
-AssetTypeModified=Asset type modified
-AssetType=Asset type
+NewAsset=New asset
+AccountancyCodeAsset=Accounting code (asset)
+AccountancyCodeDepreciationAsset=Accounting code (depreciation asset account)
+AccountancyCodeDepreciationExpense=Accounting code (depreciation expense account)
AssetsLines=Assets
DeleteType=Delete
-DeleteAnAssetType=Delete an asset type
-ConfirmDeleteAssetType=Are you sure you want to delete this asset type?
-ShowTypeCard=Show type '%s'
+DeleteAnAssetType=Delete an asset model
+ConfirmDeleteAssetType=Are you sure you want to delete this asset model?
+ShowTypeCard=Show model '%s'
# Module label 'ModuleAssetsName'
-ModuleAssetsName = Assets
+ModuleAssetsName=Assets
# Module description 'ModuleAssetsDesc'
-ModuleAssetsDesc = Assets description
+ModuleAssetsDesc=Assets description
#
# Admin page
#
-AssetsSetup = Assets setup
-Settings = Settings
-AssetsSetupPage = Assets setup page
-ExtraFieldsAssetsType = Complementary attributes (Asset type)
-AssetsType=Asset type
-AssetsTypeId=Asset type id
-AssetsTypeLabel=Asset type label
-AssetsTypes=Assets types
+AssetSetup=Assets setup
+AssetSetupPage=Assets setup page
+ExtraFieldsAssetModel=Complementary attributes (Asset's model)
+
+AssetsType=Asset model
+AssetsTypeId=Asset model id
+AssetsTypeLabel=Asset model label
+AssetsTypes=Assets models
+ASSET_ACCOUNTANCY_CATEGORY=Fixed asset accounting group
#
# Menu
#
-MenuAssets = Assets
-MenuNewAsset = New asset
-MenuTypeAssets = Type assets
-MenuListAssets = List
-MenuNewTypeAssets = New
-MenuListTypeAssets = List
+MenuAssets=Assets
+MenuNewAsset=New asset
+MenuAssetModels=Model assets
+MenuListAssets=List
+MenuNewAssetModel=New asset's model
+MenuListAssetModels=List
#
# Module
#
+ConfirmDeleteAsset=Do you really want to remove this asset?
+
+#
+# Tab
+#
+AssetDepreciationOptions=Depreciation options
+AssetAccountancyCodes=Accounting accounts
+AssetDepreciation=Depreciation
+
+#
+# Asset
+#
Asset=Asset
-NewAssetType=New asset type
-NewAsset=New asset
-ConfirmDeleteAsset=Are you sure you want to delete this asset ?
+Assets=Assets
+AssetReversalAmountHT=Reversal amount (without taxes)
+AssetAcquisitionValueHT=Acquisition amount (without taxes)
+AssetRecoveredVAT=Recovered VAT
+AssetReversalDate=Reversal date
+AssetDateAcquisition=Acquisition date
+AssetDateStart=Date of start-up
+AssetAcquisitionType=Type of acquisition
+AssetAcquisitionTypeNew=New
+AssetAcquisitionTypeOccasion=Used
+AssetType=Type of asset
+AssetTypeIntangible=Intangible
+AssetTypeTangible=Tangible
+AssetTypeInProgress=In progress
+AssetTypeFinancial=Financial
+AssetNotDepreciated=Not depreciated
+AssetDisposal=Disposal
+AssetConfirmDisposalAsk=Are you sure you want to dispose of the asset %s?
+AssetConfirmReOpenAsk=Are you sure you want to reopen the asset %s?
+
+#
+# Asset status
+#
+AssetInProgress=In progress
+AssetDisposed=Disposed
+AssetRecorded=Accounted
+
+#
+# Asset disposal
+#
+AssetDisposalDate=Date of disposal
+AssetDisposalAmount=Disposal value
+AssetDisposalType=Type of disposal
+AssetDisposalDepreciated=Depreciate the year of transfer
+AssetDisposalSubjectToVat=Disposal subject to VAT
+
+#
+# Asset model
+#
+AssetModel=Asset's model
+AssetModels=Asset's models
+
+#
+# Asset depreciation options
+#
+AssetDepreciationOptionEconomic=Economic depreciation
+AssetDepreciationOptionAcceleratedDepreciation=Accelerated depreciation (tax)
+AssetDepreciationOptionDepreciationType=Depreciation type
+AssetDepreciationOptionDepreciationTypeLinear=Linear
+AssetDepreciationOptionDepreciationTypeDegressive=Degressive
+AssetDepreciationOptionDepreciationTypeExceptional=Exceptional
+AssetDepreciationOptionDegressiveRate=Degressive rate
+AssetDepreciationOptionAcceleratedDepreciation=Accelerated (tax)
+AssetDepreciationOptionDuration=Duration
+AssetDepreciationOptionDurationType=Type duration
+AssetDepreciationOptionDurationTypeAnnual=Annual
+AssetDepreciationOptionDurationTypeMonthly=Monthly
+AssetDepreciationOptionDurationTypeDaily=Daily
+AssetDepreciationOptionRate=Rate (%%)
+AssetDepreciationOptionAmountBaseDepreciationHT=Depreciation base (excl. VAT)
+AssetDepreciationOptionAmountBaseDeductibleHT=Deductible base (excl. VAT)
+AssetDepreciationOptionTotalAmountLastDepreciationHT=Total amount last depreciation (excl. VAT)
+
+#
+# Asset accountancy codes
+#
+AssetAccountancyCodeDepreciationEconomic=Economic depreciation
+AssetAccountancyCodeAsset=Asset
+AssetAccountancyCodeDepreciationAsset=Depreciation
+AssetAccountancyCodeDepreciationExpense=Depreciation expense
+AssetAccountancyCodeValueAssetSold=Value of asset disposed
+AssetAccountancyCodeReceivableOnAssignment=Receivable on disposal
+AssetAccountancyCodeProceedsFromSales=Proceeds from disposal
+AssetAccountancyCodeVatCollected=Collected VAT
+AssetAccountancyCodeVatDeductible=Recovered VAT on assets
+AssetAccountancyCodeDepreciationAcceleratedDepreciation=Accelerated depreciation (tax)
+AssetAccountancyCodeAcceleratedDepreciation=Account
+AssetAccountancyCodeEndowmentAcceleratedDepreciation=Depreciation expense
+AssetAccountancyCodeProvisionAcceleratedDepreciation=Repossession/Provision
+
+#
+# Asset depreciation
+#
+AssetBaseDepreciationHT=Depreciation basis (excl. VAT)
+AssetDepreciationBeginDate=Start of depreciation on
+AssetDepreciationDuration=Duration
+AssetDepreciationRate=Rate (%%)
+AssetDepreciationDate=Depreciation date
+AssetDepreciationHT=Depreciation (excl. VAT)
+AssetCumulativeDepreciationHT=Cumulative depreciation (excl. VAT)
+AssetResidualHT=Residual value (excl. VAT)
+AssetDispatchedInBookkeeping=Depreciation recorded
+AssetFutureDepreciationLine=Future depreciation
+AssetDepreciationReversal=Reversal
+
+#
+# Errors
+#
+AssetErrorAssetOrAssetModelIDNotProvide=Id of the asset or the model sound has not been provided
+AssetErrorFetchAccountancyCodesForMode=Error when retrieving the accounting accounts for the '%s' depreciation mode
+AssetErrorDeleteAccountancyCodesForMode=Error when deleting accounting accounts from the '%s' depreciation mode
+AssetErrorInsertAccountancyCodesForMode=Error when inserting the accounting accounts of the depreciation mode '%s'
+AssetErrorFetchDepreciationOptionsForMode=Error when retrieving options for the '%s' depreciation mode
+AssetErrorDeleteDepreciationOptionsForMode=Error when deleting the '%s' depreciation mode options
+AssetErrorInsertDepreciationOptionsForMode=Error when inserting the '%s' depreciation mode options
+AssetErrorFetchDepreciationLines=Error when retrieving recorded depreciation lines
+AssetErrorClearDepreciationLines=Error when purging recorded depreciation lines (reversal and future)
+AssetErrorAddDepreciationLine=Error when adding a depreciation line
+AssetErrorCalculationDepreciationLines=Error when calculating the depreciation lines (recovery and future)
+AssetErrorReversalDateNotProvidedForMode=The reversal date is not provided for the '%s' depreciation method
+AssetErrorReversalDateNotGreaterThanCurrentBeginFiscalDateForMode=The reversal date must be greater than or equal to the beginning of the current fiscal year for the '%s' depreciation method
+AssetErrorReversalAmountNotProvidedForMode=The reversal amount is not provided for the depreciation mode '%s'.
+AssetErrorFetchCumulativeDepreciation=Error when retrieving the accumulated depreciation amount from the depreciation line
+AssetErrorSetLastCumulativeDepreciation=Error when recording the last accumulated depreciation amount
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/cron.lang b/htdocs/langs/en_US/cron.lang
index 4fd2220dea6..9705f8823b0 100644
--- a/htdocs/langs/en_US/cron.lang
+++ b/htdocs/langs/en_US/cron.lang
@@ -82,6 +82,8 @@ UseMenuModuleToolsToAddCronJobs=Go into menu "Home - Admin tools -
JobDisabled=Job disabled
MakeLocalDatabaseDumpShort=Local database backup
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
+MakeSendLocalDatabaseDumpShort=Send local database backup
+MakeSendLocalDatabaseDump=Send local database backup by email. Parameters are: to, from, subject, message, filename (Name of file sent), filter ('sql' for backup of database only)
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
DATAPOLICYJob=Data cleaner and anonymizer
JobXMustBeEnabled=Job %s must be enabled
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 98d83aa9453..86d11ec59ea 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)
@@ -278,6 +278,7 @@ ErrorIsNotADraft=%s is not a draft
ErrorExecIdFailed=Can't execute command "id"
ErrorBadCharIntoLoginName=Unauthorized character in the login name
ErrorRequestTooLarge=Error, request too large
+ErrorNotApproverForHoliday=You are not the approver for leave %s
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 2867c7b853b..62d167ea233 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1165,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/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 61b5c939d12..7610aa78e9e 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -94,7 +94,7 @@ LanguageDefDesc=Enter in this files, all the key and the translation for each la
MenusDefDesc=Define here the menus provided by your module
DictionariesDefDesc=Define here the dictionaries provided by your module
PermissionsDefDesc=Define here the new permissions provided by your module
-MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
+MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and the module re-activated), the menus are also visible into the menu editor available to administrator users on %s.
DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array $this->dictionaries into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s.
PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array $this->rights into the module descriptor file. You can edit manually this file or use the embedded editor.
Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
HooksDefDesc=Define in the module_parts['hooks'] property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on 'initHooks(' in core code). Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on 'executeHooks' in core code).
@@ -110,7 +110,7 @@ DropTableIfEmpty=(Destroy table if empty)
TableDoesNotExists=The table %s does not exists
TableDropped=Table %s deleted
InitStructureFromExistingTable=Build the structure array string of an existing table
-UseAboutPage=Disable the about page
+UseAboutPage=Do not generate the About page
UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe
ContentOfREADMECustomized=Note: The content of the README.md file has been replaced with the specific value defined into setup of ModuleBuilder.
@@ -138,10 +138,12 @@ CSSViewClass=CSS for read form
CSSListClass=CSS for list
NotEditable=Not editable
ForeignKey=Foreign key
-TypeOfFieldsHelp=Type of fields: varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
+TypeOfFieldsHelp=Type of fields: varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] '1' means we add a + button after the combo to create the record 'filter' is a sql condition, example: 'status=1 AND fk_user=__USER_ID__ AND entity IN (__SHARED_ENTITIES__)'
AsciiToHtmlConverter=Ascii to HTML converter
AsciiToPdfConverter=Ascii to PDF converter
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required
+WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
+LinkToParentMenu=Parent menu (fk_xxxxmenu)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 14715670882..aaa2fe0ead0 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -137,7 +137,8 @@ ConfirmDeleteProductLine=Are you sure you want to delete this product line?
ProductSpecial=Special
QtyMin=Min. purchase quantity
PriceQtyMin=Price quantity min.
-PriceQtyMinCurrency=Price (currency) for this qty. (no discount)
+PriceQtyMinCurrency=Price (currency) for this qty.
+WithoutDiscount=Without discount
VATRateForSupplierProduct=VAT Rate (for this vendor/product)
DiscountQtyMin=Discount for this qty.
NoPriceDefinedForThisSupplier=No price/qty defined for this vendor/product
@@ -346,7 +347,7 @@ UseProductFournDesc=Add a feature to define the product description defined by t
ProductSupplierDescription=Vendor description for the product
UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents)
PackagingForThisProduct=Packaging
-PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity
+PackagingForThisProductDesc=You will automaticaly buy a multiple of this quantity. Can't be lower than the minimum purchase quantity
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging
#Attributes
@@ -411,3 +412,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/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang
index 284c4fa61fa..eb115682726 100644
--- a/htdocs/langs/en_US/receiptprinter.lang
+++ b/htdocs/langs/en_US/receiptprinter.lang
@@ -7,7 +7,7 @@ TestSentToPrinter=Test Sent To Printer %s
ReceiptPrinter=Receipt printers
ReceiptPrinterDesc=Setup of receipt printers
ReceiptPrinterTemplateDesc=Setup of Templates
-ReceiptPrinterTypeDesc=Description of Receipt Printer's type
+ReceiptPrinterTypeDesc=Example of possible values for the field "Parameters" according to the type of driver
ReceiptPrinterProfileDesc=Description of Receipt Printer's Profile
ListPrinters=List of Printers
SetupReceiptTemplate=Template Setup
diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang
index ebd67df79c9..98faab0c423 100644
--- a/htdocs/langs/en_US/stocks.lang
+++ b/htdocs/langs/en_US/stocks.lang
@@ -254,7 +254,7 @@ ReOpen=Reopen
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory.
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close
-AutofillWithExpected=Replace real quantity with expected quantity
+AutofillWithExpected=Fill real quantity with expected quantity
ShowAllBatchByDefault=By default, show batch details on product "stock" tab
CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration
ErrorWrongBarcodemode=Unknown Barcode mode
@@ -270,4 +270,5 @@ ErrorOnElementsInventory=Operation canceled for the following reason:
ErrorCantFindCodeInInventory=Can't find the following code in inventory
QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool.
StockChangeDisabled=Change on stock disabled
-NoWarehouseDefinedForTerminal=No warehouse defined for terminal
\ No newline at end of file
+NoWarehouseDefinedForTerminal=No warehouse defined for terminal
+ClearQtys=Clear all quantities
\ No newline at end of file
diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang
index 38b199f7260..310ac8dd7f6 100644
--- a/htdocs/langs/en_US/ticket.lang
+++ b/htdocs/langs/en_US/ticket.lang
@@ -138,6 +138,13 @@ 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.
+TicketsAutoNotifyClose=Automatically notify thirdparty when closing a ticket
+TicketsAutoNotifyCloseHelp=When closing a ticket, you will be proposed to send a message to one of thirdparty's contacts. On mass closing, a message will be sent to one contact of the thirdparty linked to the ticket.
+TicketWrongContact=Provided contact is not part of current ticket contacts. Email not sent.
#
# Index & list page
@@ -154,6 +161,8 @@ OrderByDateAsc=Sort by ascending date
OrderByDateDesc=Sort by descending date
ShowAsConversation=Show as conversation list
MessageListViewType=Show as table list
+ConfirmMassTicketClosingSendEmail=Automatically send emails when closing tickets
+ConfirmMassTicketClosingSendEmailQuestion=Do you want to notify thirdparties when closing these tickets ?
#
# Ticket card
@@ -241,9 +250,14 @@ TicketChangeStatus=Change status
TicketConfirmChangeStatus=Confirm the status change: %s ?
TicketLogStatusChanged=Status changed: %s to %s
TicketNotNotifyTiersAtCreate=Not notify company at create
+NotifyThirdpartyOnTicketClosing=Contacts to notify while closing the ticket
+TicketNotifyAllTiersAtClose=All related contacts
+TicketNotNotifyTiersAtClose=No related contact
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
@@ -273,6 +287,7 @@ TicketNewEmailBodyInfosTicket=Information for monitoring the ticket
TicketNewEmailBodyInfosTrackId=Ticket tracking number: %s
TicketNewEmailBodyInfosTrackUrl=You can view the progress of the ticket by clicking the link above.
TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket in the specific interface by clicking the following link
+TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link
TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface.
TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system.
TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request.
@@ -294,6 +309,10 @@ NewUser=New user
NumberOfTicketsByMonth=Number of tickets per month
NbOfTickets=Number of tickets
# notifications
+TicketCloseEmailSubjectCustomer=Ticket closed
+TicketCloseEmailBodyCustomer=This is an automatic message to notify you that ticket %s has just been closed.
+TicketCloseEmailSubjectAdmin=Ticket closed - Réf %s (public ticket ID %s)
+TicketCloseEmailBodyAdmin=A ticket with ID #%s has just been closed, see information:
TicketNotificationEmailSubject=Ticket %s updated
TicketNotificationEmailBody=This is an automatic message to notify you that ticket %s has just been updated
TicketNotificationRecipient=Notification recipient
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 8ddcce45285..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
@@ -3263,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/admin/setup.php b/htdocs/modulebuilder/admin/setup.php
index e5ccb0c3966..01a02d0c7dd 100644
--- a/htdocs/modulebuilder/admin/setup.php
+++ b/htdocs/modulebuilder/admin/setup.php
@@ -120,7 +120,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '';
print '| '.$langs->trans("UseAboutPage").' | ';
- print '';
+ print ' | ';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MODULEBUILDER_USE_ABOUT');
} else {
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index e0bd19ab251..240c739e5c0 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -955,6 +955,21 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($fieldname == 'entity') {
$index = 1;
}
+ // css
+ $css = '';
+ $cssview = '';
+ $csslist = '';
+ if (preg_match('/^fk_/', $fieldname)) {
+ $css = 'maxwidth500 widthcentpercentminusxx';
+ }
+ if ($fieldname == 'label') {
+ $css = 'minwidth300';
+ $cssview = 'wordbreak';
+ }
+ if (in_array($fieldname, array('note_public', 'note_private'))) {
+ $cssview = 'wordbreak';
+ }
+
$string .= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
if ($default != '') {
@@ -972,6 +987,15 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($index) {
$string .= ", 'index'=>".$index;
}
+ if ($css) {
+ $string .= ", 'css'=>".$css;
+ }
+ if ($cssview) {
+ $string .= ", 'cssview'=>".$cssview;
+ }
+ if ($csslist) {
+ $string .= ", 'csslist'=>".$csslist;
+ }
$string .= "),\n";
$string .= " ";
$i += 5;
@@ -1307,7 +1331,6 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
- }
if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) {
$addfieldentry = array(
@@ -1324,16 +1347,18 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
- 'css'=>GETPOST('propcss', 'aZ09'),
- 'cssview'=>GETPOST('propcssview', 'aZ09'),
- 'csslist'=>GETPOST('propcsslist', 'aZ09'),
+ 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
+ 'cssview'=>GETPOST('propcssview', 'alpha'),
+ 'csslist'=>GETPOST('propcsslist', 'alpha'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
);
- if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
- $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
+
+ if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
+ $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
+ }
}
} else {
$addfieldentry = array();
@@ -1348,8 +1373,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
// Edit the class file to write properties
if (!$error) {
$moduletype = 'external';
-
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
+
if (is_numeric($object) && $object <= 0) {
$error++;
}
@@ -1368,6 +1393,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
if (!$error) {
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null);
+ setEventMessages($langs->trans('WarningDatabaseIsNotUpdated'), null);
+
clearstatcache(true);
// Make a redirect to reload all data
@@ -1942,6 +1969,11 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'description';
$h++;
+ $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '');
+ $head2[$h][1] = $langs->trans("Objects");
+ $head2[$h][2] = 'objects';
+ $h++;
+
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Languages");
$head2[$h][2] = 'languages';
@@ -1952,11 +1984,6 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'dictionaries';
$h++;
- $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '');
- $head2[$h][1] = $langs->trans("Objects");
- $head2[$h][2] = 'objects';
- $h++;
-
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Permissions");
$head2[$h][2] = 'permissions';
@@ -2289,7 +2316,7 @@ if ($module == 'initmodule') {
print '';
print '';
- print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, ' aaa ');
print_liste_field_titre("Table", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SQL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
@@ -2539,8 +2566,9 @@ if ($module == 'initmodule') {
$pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php';
$realpathtoapi = $dirread.'/'.$pathtoapi;
}
- $urloflist = $dirread.'/'.$pathtolist;
- $urlofcard = $dirread.'/'.$pathtocard;
+
+ $urloflist = dol_buildpath('/'.$pathtolist, 1);
+ $urlofcard = dol_buildpath('/'.$pathtocard, 1);
print '';
print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : '').'';
@@ -2701,7 +2729,7 @@ if ($module == 'initmodule') {
print ' ';
print ' ';
print '';
- print '| '.$langs->trans("Property");
+ print ' | '.$langs->trans("Property");
print ' ('.$langs->trans("SeeExamples").')';
print ' | ';
print '';
@@ -2727,7 +2755,7 @@ if ($module == 'initmodule') {
//print ' | '.$langs->trans("Disabled").' | ';
print ''.$form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")).' | ';
print ''.$langs->trans("Comment").' | ';
- print ' | ';
+ print ' | ';
print ' ';
// We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobjet->fields may have been
@@ -2738,7 +2766,7 @@ if ($module == 'initmodule') {
if (!empty($properties)) {
// Line to add a property
print '';
- print ' | ';
+ print ' | ';
print ' | ';
print ' | ';
print ' | ';
@@ -2760,7 +2788,7 @@ if ($module == 'initmodule') {
//print ' | ';
print ' | ';
print ' | ';
- print '';
+ print ' | ';
print '';
print ' | ';
@@ -2805,7 +2833,7 @@ if ($module == 'initmodule') {
print '';
- print '| ';
+ print ' | ';
print dol_escape_htmltag($propname);
print ' | ';
print '';
@@ -2820,7 +2848,7 @@ if ($module == 'initmodule') {
print ' | ';
print '';
print '';
@@ -2876,7 +2904,7 @@ if ($module == 'initmodule') {
print ' | ';
print '';
print ' | ';
- print '';
+ print ' | ';
print '';
print '';
print ' | ';
@@ -2886,8 +2914,8 @@ if ($module == 'initmodule') {
print '';
print '';
if ($proparrayofkeyval) {
- print '';
- print dol_escape_htmltag(json_encode($proparrayofkeyval));
+ print '';
+ print dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE));
print '';
}
print ' | ';
@@ -2947,7 +2975,7 @@ if ($module == 'initmodule') {
print dol_escape_htmltag($propcomment);
print '';
print '';
- print '';
+ print ' | ';
if ($propname != 'rowid') {
print ''.img_edit().'';
print ''.img_delete().'';
@@ -3081,14 +3109,14 @@ if ($module == 'initmodule') {
print ' | ';
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("fk_menu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("RelativeURL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
@@ -3126,15 +3154,15 @@ if ($module == 'initmodule') {
print dol_escape_htmltag($menu['langs']);
print '';
- print '| ';
+ print ' | ';
print dol_escape_htmltag($menu['position']);
print ' | ';
- print '';
+ print ' | ';
print dol_escape_htmltag($menu['enabled']);
print ' | ';
- print '';
+ print ' | ';
print dol_escape_htmltag($menu['perms']);
print ' | ';
@@ -3836,8 +3864,10 @@ if ($module == 'initmodule') {
$FILENAMEDOCPDF = $modulelowercase.'.pdf';
$outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
$outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
+ $outputfiledocrel = $modulelowercase.'/doc/'.$FILENAMEDOC;
$outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
+ $outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF;
// HTML
print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
@@ -3850,6 +3880,7 @@ if ($module == 'initmodule') {
print '';
print '';
print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')';
+ print ' '.img_picto($langs->trans("Delete"), 'delete').'';
}
print ' ';
@@ -3864,6 +3895,7 @@ if ($module == 'initmodule') {
print '';
print '';
print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')';
+ print ' '.img_picto($langs->trans("Delete"), 'delete').'';
}
print ' ';
@@ -3930,8 +3962,11 @@ if ($module == 'initmodule') {
$relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP;
print ''.$outputfilezip.'';
print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')';
+ print ' '.img_picto($langs->trans("Delete"), 'delete').'';
}
- print ' ';
+ print '';
+
+ print ' ';
print ' ';
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index ac934439934..4e88703b454 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -108,11 +108,11 @@ class MyObject extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1),
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
- 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1),
- 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501),
//'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
@@ -122,7 +122,7 @@ class MyObject extends CommonObject
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010),
- 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
);
/**
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 13e34593bba..874d964ad6e 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -305,7 +305,7 @@ class modMyModule extends DolibarrModules
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
- 'type'=>'left', // This is a Top menu entry
+ 'type'=>'left', // This is a Left menu entry
'titre'=>'MyObject',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
'mainmenu'=>'mymodule',
@@ -432,7 +432,7 @@ class modMyModule extends DolibarrModules
$sql = array();
// Document templates
- $moduledir = 'mymodule';
+ $moduledir = dol_sanitizeFileName('mymodule');
$myTmpObjects = array();
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
@@ -441,8 +441,8 @@ class modMyModule extends DolibarrModules
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
- $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
- $dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
+ $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt';
+ $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_myobjects.odt';
if (file_exists($src) && !file_exists($dest)) {
diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
index 2f0ecd06774..21cb16c3644 100644
--- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
+++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php
@@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) {
}
-print "\n";
+print "\n";
global $user;
diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
index e29057c5423..37ece327185 100644
--- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
+++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
@@ -28,8 +28,6 @@
* - interface_99_all_MyTrigger.class.php
* - The file must stay in core/triggers
* - The class name must be InterfaceMytrigger
- * - The constructor method must be named InterfaceMytrigger
- * - The name property name must be MyTrigger
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php
index 5eb4f6e3028..b40092f93a7 100644
--- a/htdocs/modulebuilder/template/myobject_agenda.php
+++ b/htdocs/modulebuilder/template/myobject_agenda.php
@@ -132,15 +132,24 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
-$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permissiontoadd = $user->rights->mymodule->myobject->write;
+} else {
+ $permissiontoread = 1;
+ $permissiontoadd = 1;
+}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
+if (empty($conf->mymodule->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
/*
@@ -187,7 +196,7 @@ if ($object->id > 0) {
$head = myobjectPrepareHead($object);
- print dol_get_fiche_head($head, 'agenda', '', -1, $object->picto);
+ print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 531d463eea1..6d5c807c3f0 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -122,12 +122,23 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+ $permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
+ $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
+ $permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
+} else {
+ $permissiontoread = 1;
+ $permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+ $permissiontodelete = 1;
+ $permissionnote = 1;
+ $permissiondellink = 1;
+}
-$permissiontoread = $user->rights->mymodule->myobject->read;
-$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
-$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
-$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
-$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1].'/myobject';
// Security check (enable the most restrictive one)
@@ -135,8 +146,8 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
+if (empty($conf->mymodule->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
/*
@@ -230,6 +241,11 @@ llxHeader('', $title, $help_url);
// Part to create
if ($action == 'create') {
+ if (empty($permissiontoadd)) {
+ accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1);
+ exit;
+ }
+
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")), '', 'object_'.$object->picto);
print '';
diff --git a/htdocs/modulebuilder/template/myobject_contact.php b/htdocs/modulebuilder/template/myobject_contact.php
index d2de342c861..64f5ebba976 100644
--- a/htdocs/modulebuilder/template/myobject_contact.php
+++ b/htdocs/modulebuilder/template/myobject_contact.php
@@ -78,15 +78,24 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
-$permission = $user->rights->mymodule->myobject->write;
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permission = $user->rights->mymodule->myobject->write;
+} else {
+ $permissiontoread = 1;
+ $permission = 1;
+}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
+if (empty($conf->mymodule->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
/*
@@ -152,7 +161,7 @@ if ($object->id) {
*/
$head = myobjectPrepareHead($object);
- print dol_get_fiche_head($head, 'contact', '', -1, $object->picto);
+ print dol_get_fiche_head($head, 'contact', $langs->trans("MyObject"), -1, $object->picto);
$linkback = ''.$langs->trans("BackToList").'';
diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php
index 3db0271dd01..d1040364182 100644
--- a/htdocs/modulebuilder/template/myobject_document.php
+++ b/htdocs/modulebuilder/template/myobject_document.php
@@ -124,15 +124,24 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object);
}
-$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
+} else {
+ $permissiontoread = 1;
+ $permission = 1;
+}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
+if (empty($conf->mymodule->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
/*
@@ -159,7 +168,7 @@ if ($object->id) {
*/
$head = myobjectPrepareHead($object);
- print dol_get_fiche_head($head, 'document', '', -1, $object->picto);
+ print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto);
// Build file list
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index ee4d4b73026..589f4052724 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -178,13 +178,17 @@ $object->fields = dol_sort_array($object->fields, 'position');
//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
$arrayfields = dol_sort_array($arrayfields, 'position');
-$permissiontoread = $user->rights->mymodule->myobject->read;
-$permissiontoadd = $user->rights->mymodule->myobject->write;
-$permissiontodelete = $user->rights->mymodule->myobject->delete;
-
-// Security check
-if (empty($conf->mymodule->enabled)) {
- accessforbidden('Module not enabled');
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permissiontoadd = $user->rights->mymodule->myobject->write;
+ $permissiontodelete = $user->rights->mymodule->myobject->delete;
+} else {
+ $permissiontoread = 1;
+ $permissiontoadd = 1;
+ $permissiontodelete = 1;
}
// Security check (enable the most restrictive one)
@@ -193,9 +197,8 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
-
+if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled');
+if (!$permissiontoread) accessforbidden();
/*
diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php
index 6733919289b..bda60f90d52 100644
--- a/htdocs/modulebuilder/template/myobject_note.php
+++ b/htdocs/modulebuilder/template/myobject_note.php
@@ -101,23 +101,35 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
-$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
-$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+ $permissiontoread = $user->rights->mymodule->myobject->read;
+ $permissiontoadd = $user->rights->mymodule->myobject->write;
+ $permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
+} else {
+ $permissiontoread = 1;
+ $permissiontoadd = 1;
+ $permissionnote = 1;
+}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-//if (empty($conf->mymodule->enabled)) accessforbidden();
-//if (!$permissiontoread) accessforbidden();
+if (empty($conf->mymodule->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
/*
* Actions
*/
-$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
+$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');
}
@@ -134,14 +146,15 @@ $form = new Form($db);
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
$help_url = '';
-llxHeader('', $langs->trans('MyObject'), $help_url);
+$title = $langs->trans('MyObject').' - '.$langs->trans("Notes");
+llxHeader('', $title, $help_url);
if ($id > 0 || !empty($ref)) {
$object->fetch_thirdparty();
$head = myobjectPrepareHead($object);
- print dol_get_fiche_head($head, 'note', '', -1, $object->picto);
+ print dol_get_fiche_head($head, 'note', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------
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/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index 2da1672e089..21ebd1ec5f5 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -113,8 +113,8 @@ class Mo extends CommonObject
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
- 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
- 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
+ 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
+ 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php
index e5648cad5f7..6e15a71e517 100644
--- a/htdocs/mrp/mo_list.php
+++ b/htdocs/mrp/mo_list.php
@@ -109,11 +109,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php
index 5dbe583fd21..ff9aa269678 100644
--- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php
@@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
-print "\n";
+print "\n";
global $user, $db;
global $noMoreLinkedObjectBlockAfter;
diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php
index 0dc9f7ce63a..1ebf33d3925 100644
--- a/htdocs/multicurrency/class/multicurrency.class.php
+++ b/htdocs/multicurrency/class/multicurrency.class.php
@@ -493,20 +493,20 @@ class MultiCurrency extends CommonObject
/**
* Get id of currency from code
*
- * @param DoliDB $db object db
+ * @param DoliDB $dbs object db
* @param string $code code value search
*
* @return int 0 if not found, >0 if OK
*/
- public static function getIdFromCode($db, $code)
+ public static function getIdFromCode($dbs, $code)
{
global $conf;
- $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE code = '".$db->escape($code)."' AND entity = ".$conf->entity;
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE code = '".$dbs->escape($code)."' AND entity = ".((int) $conf->entity);
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $db->query($sql);
- if ($resql && $obj = $db->fetch_object($resql)) {
+ $resql = $dbs->query($sql);
+ if ($resql && $obj = $dbs->fetch_object($resql)) {
return $obj->rowid;
} else {
return 0;
@@ -516,38 +516,38 @@ class MultiCurrency extends CommonObject
/**
* Get id and rate of currency from code
*
- * @param DoliDB $db Object db
+ * @param DoliDB $dbs Object db
* @param string $code Code value search
* @param integer $date_document Date from document (propal, order, invoice, ...)
*
* @return array [0] => id currency
* [1] => rate
*/
- public static function getIdAndTxFromCode($db, $code, $date_document = '')
+ public static function getIdAndTxFromCode($dbs, $code, $date_document = '')
{
global $conf;
$sql1 = "SELECT m.rowid, mc.rate FROM ".MAIN_DB_PREFIX."multicurrency m";
$sql1 .= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
- $sql1 .= " WHERE m.code = '".$db->escape($code)."'";
+ $sql1 .= " WHERE m.code = '".$dbs->escape($code)."'";
$sql1 .= " AND m.entity IN (".getEntity('multicurrency').")";
$sql2 = '';
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) { // Use last known rate compared to document date
$tmparray = dol_getdate($date_document);
- $sql2 .= " AND mc.date_sync <= '".$db->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'";
+ $sql2 .= " AND mc.date_sync <= '".$dbs->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'";
}
$sql3 = " ORDER BY mc.date_sync DESC LIMIT 1";
dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $db->query($sql1.$sql2.$sql3);
+ $resql = $dbs->query($sql1.$sql2.$sql3);
- if ($resql && $obj = $db->fetch_object($resql)) {
+ if ($resql && $obj = $dbs->fetch_object($resql)) {
return array($obj->rowid, $obj->rate);
} else {
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) {
- $resql = $db->query($sql1.$sql3);
- if ($resql && $obj = $db->fetch_object($resql)) {
+ $resql = $dbs->query($sql1.$sql3);
+ if ($resql && $obj = $dbs->fetch_object($resql)) {
return array($obj->rowid, $obj->rate);
}
}
@@ -746,7 +746,7 @@ class CurrencyRate extends CommonObjectLine
*/
public function __construct(DoliDB $db)
{
- $this->db = &$db;
+ $this->db = $db;
return 1;
}
diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php
index 73cff1b4502..46742995bec 100644
--- a/htdocs/multicurrency/multicurrency_rate.php
+++ b/htdocs/multicurrency/multicurrency_rate.php
@@ -250,6 +250,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) {
print '';
print '';
+ print '';
+
print '';
print ' ';
@@ -404,7 +407,7 @@ if ($resql) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
- print '';
+ print ' ';
print ' '."\n";
// Lines with input filters
@@ -426,7 +429,7 @@ if ($resql) {
// rate
if (!empty($arrayfields['cr.rate']['checked'])) {
print '| ';
- print '';
+ print '';
print ' | ';
}
diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php
index 3f822679350..bc018a2dda1 100644
--- a/htdocs/opensurvey/card.php
+++ b/htdocs/opensurvey/card.php
@@ -137,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);
@@ -422,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..f372e847455 100644
--- a/htdocs/opensurvey/results.php
+++ b/htdocs/opensurvey/results.php
@@ -53,7 +53,7 @@ $nblines = $object->fetch_lines();
// Return to the results
if (GETPOST('retoursondage')) {
- header('Location: results.php?id='.GETPOST('id', 'int'));
+ header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'int')));
exit;
}
@@ -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";
@@ -588,6 +588,7 @@ if (GETPOST('ajoutsujet')) {
$tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList"));
print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'
';
print '';
+ print '';
print ' ';
print '';
print '
'."\n";
@@ -663,6 +664,7 @@ $nbcolonnes = substr_count($object->sujet, ',') + 1;
print ''."\n";
print '';
+print '';
print ' '."\n";
@@ -851,7 +853,7 @@ while ($compteur < $num) {
print ' | '."\n";
if ($user->rights->opensurvey->write) {
- print ''."\n";
+ print ''."\n";
}
// Name
@@ -1012,7 +1014,7 @@ while ($compteur < $num) {
// Button edit at end of line
if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write)) {
- print ' | | '."\n";
+ print ' | '."\n";
}
//demande de confirmation pour modification de ligne
@@ -1021,7 +1023,7 @@ while ($compteur < $num) {
if ($compteur == $i) {
print '';
print '';
- print '';
+ print '';
print ' | '."\n";
}
}
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 'id.'&action=reopen&token='.newToken().'">'.$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..dc9958fa3df 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 = '';
@@ -118,11 +118,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
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 '";
+}
+
+
+/*
+ * 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/admin/product.php b/htdocs/product/admin/product.php
index 2d7d99a9ab3..eeeaa094f29 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -144,33 +144,17 @@ if ($action == 'other') {
$value = GETPOST('activate_usesearchtoselectproduct', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value, 'chaine', 0, '', $conf->entity);
- $value = GETPOST('activate_useProdFournDesc', 'alpha');
- $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity);
-
$value = GETPOST('activate_FillProductDescAuto', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity);
- if ($value) {
- $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
- $resql = $db->query($sql_test);
- if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
- $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text";
- $resql_new = $db->query($sql_new);
- }
- }
+ $value = GETPOST('PRODUIT_FOURN_TEXTS', 'alpha');
+ $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity);
- $value = GETPOST('activate_useProdSupplierPackaging', 'alpha');
+ $value = GETPOST('PRODUCT_USE_SUPPLIER_PACKAGING', 'alpha');
$res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity);
- if ($value) {
- $sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
- $resql = $db->query($sql_test);
- if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
- $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1";
- $resql_new = $db->query($sql_new);
- }
- }
}
+
if ($action == 'specimen') { // For products
$modele = GETPOST('module', 'alpha');
@@ -250,12 +234,22 @@ if ($action == 'set') {
}
}
-//if ($action == 'other')
-//{
-// $value = GETPOST('activate_units', 'alpha');
-// $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity);
-// if (! $res > 0) $error++;
-//}
+// To enable a constant whithout javascript
+if (preg_match('/set_(.+)/', $action, $reg)) {
+ $keyforvar = $reg[1];
+ if ($keyforvar) {
+ $value = 1;
+ $res = dolibarr_set_const($db, $keyforvar, $value, 'chaine', 0, '', $conf->entity);
+ }
+}
+
+// To disable a constant whithout javascript
+if (preg_match('/del_(.+)/', $action, $reg)) {
+ $keyforvar = $reg[1];
+ if ($keyforvar) {
+ $res = dolibarr_del_const($db, $keyforvar, $conf->entity);
+ }
+}
if ($action) {
if (!$error) {
@@ -590,7 +584,7 @@ print '';
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
print '';
print '| '.$langs->trans("MultiPricesNumPrices").' | ';
- print ' | ';
+ print ' | ';
print ' ';
}
@@ -604,16 +598,18 @@ print '';
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
print '';
- print '| '.$langs->trans("UseProductFournDesc").' | ';
- print '';
- print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1);
+ print ' | '.$langs->trans("UseProductSupplierPackaging").' | ';
+ print '';
+ print ajax_constantonoff("PRODUCT_USE_SUPPLIER_PACKAGING", array(), $conf->entity, 0, 0, 0, 0);
+ //print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1);
print ' | ';
print ' ';
print '';
- print '| '.$langs->trans("UseProductSupplierPackaging").' | ';
- print '';
- print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1);
+ print ' | '.$langs->trans("UseProductFournDesc").' | ';
+ print '';
+ print ajax_constantonoff("PRODUIT_FOURN_TEXTS", array(), $conf->entity, 0, 0, 0, 0);
+ //print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1);
print ' | ';
print ' ';
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 8e61663d339..839a9f18ba2 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -272,7 +272,7 @@ class Product extends CommonObject
public $fk_default_bom;
/**
- * We must manage lot/batch number, sell-by date and so on : '1':yes '0':no
+ * We must manage lot/batch number, sell-by date and so on : '0':no, '1':yes, '2": yes with unique serial number
*
* @var int
*/
@@ -1979,7 +1979,10 @@ class Product extends CommonObject
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.packaging";
$sql .= " FROM ".$this->db->prefix()."product_fournisseur_price as pfp";
- $sql .= " WHERE pfp.fk_product = ".((int) $product_id);
+ $sql .= " WHERE 1 = 1";
+ if ($product_id > 0) {
+ $sql .= " AND pfp.fk_product = ".((int) $product_id);
+ }
if ($fourn_ref != 'none') {
$sql .= " AND pfp.ref_fourn = '".$this->db->escape($fourn_ref)."'";
}
diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php
index 5149dd2c708..790a7aace44 100644
--- a/htdocs/product/class/productbatch.class.php
+++ b/htdocs/product/class/productbatch.class.php
@@ -428,13 +428,13 @@ class Productbatch extends CommonObject
/**
* Return all batch detail records for a given product and warehouse
*
- * @param DoliDB $db database object
+ * @param DoliDB $dbs database object
* @param int $fk_product_stock id product_stock for objet
* @param int $with_qty 1 = doesn't return line with 0 quantity
* @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot
* @return array <0 if KO, array of batch
*/
- public static function findAll($db, $fk_product_stock, $with_qty = 0, $fk_product = 0)
+ public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_product = 0)
{
global $conf;
@@ -453,9 +453,9 @@ class Productbatch extends CommonObject
$sql .= ", pl.rowid as lotid, pl.eatby as eatby, pl.sellby as sellby";
// TODO May add extrafields to ?
}
- $sql .= " FROM ".$db->prefix()."product_batch as t";
+ $sql .= " FROM ".$dbs->prefix()."product_batch as t";
if ($fk_product > 0) {
- $sql .= " LEFT JOIN ".$db->prefix()."product_lot as pl ON pl.fk_product = ".((int) $fk_product)." AND pl.batch = t.batch";
+ $sql .= " LEFT JOIN ".$dbs->prefix()."product_lot as pl ON pl.fk_product = ".((int) $fk_product)." AND pl.batch = t.batch";
// TODO May add extrafields to ?
}
$sql .= " WHERE fk_product_stock=".((int) $fk_product_stock);
@@ -470,20 +470,20 @@ class Productbatch extends CommonObject
$sql .= ", t.qty ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation
dol_syslog("productbatch::findAll", LOG_DEBUG);
- $resql = $db->query($sql);
+ $resql = $dbs->query($sql);
if ($resql) {
- $num = $db->num_rows($resql);
+ $num = $dbs->num_rows($resql);
$i = 0;
while ($i < $num) {
- $obj = $db->fetch_object($resql);
+ $obj = $dbs->fetch_object($resql);
- $tmp = new Productbatch($db);
+ $tmp = new Productbatch($dbs);
$tmp->id = $obj->rowid;
$tmp->lotid = $obj->lotid;
- $tmp->tms = $db->jdate($obj->tms);
+ $tmp->tms = $dbs->jdate($obj->tms);
$tmp->fk_product_stock = $obj->fk_product_stock;
- $tmp->sellby = $db->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
- $tmp->eatby = $db->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
+ $tmp->sellby = $dbs->jdate($obj->sellby ? $obj->sellby : $obj->oldsellby);
+ $tmp->eatby = $dbs->jdate($obj->eatby ? $obj->eatby : $obj->oldeatby);
$tmp->batch = $obj->batch;
$tmp->qty = $obj->qty;
$tmp->import_key = $obj->import_key;
@@ -491,11 +491,11 @@ class Productbatch extends CommonObject
$ret[$tmp->batch] = $tmp; // $ret is for a $fk_product_stock and unique key is on $fk_product_stock+batch
$i++;
}
- $db->free($resql);
+ $dbs->free($resql);
return $ret;
} else {
- $error = "Error ".$db->lasterror();
+ $error = "Error ".$dbs->lasterror();
return -1;
}
}
@@ -503,7 +503,6 @@ class Productbatch extends CommonObject
/**
* Return all batch for a product and a warehouse
*
- * @param DoliDB $db Database object
* @param int $fk_product Id of product
* @param int $fk_warehouse Id of warehouse
* @param int $qty_min [=NULL] Minimum quantity
@@ -513,7 +512,7 @@ class Productbatch extends CommonObject
*
* @throws Exception
*/
- public static function findAllForProduct($db, $fk_product, $fk_warehouse = 0, $qty_min = null, $sortfield = null, $sortorder = null)
+ public function findAllForProduct($fk_product, $fk_warehouse = 0, $qty_min = null, $sortfield = null, $sortorder = null)
{
$productBatchList = array();
@@ -526,10 +525,10 @@ class Productbatch extends CommonObject
$sql .= ", pl.sellby";
$sql .= ", pl.eatby";
$sql .= ", pb.qty";
- $sql .= " FROM ".$db->prefix()."product_lot as pl";
- $sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = pl.fk_product";
- $sql .= " LEFT JOIN ".$db->prefix()."product_batch AS pb ON pl.batch = pb.batch";
- $sql .= " LEFT JOIN ".$db->prefix()."product_stock AS ps ON ps.rowid = pb.fk_product_stock";
+ $sql .= " FROM ".$this->db->prefix()."product_lot as pl";
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = pl.fk_product";
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_batch AS pb ON pl.batch = pb.batch";
+ $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock AS ps ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND pl.fk_product = ".((int) $fk_product);
if ($fk_warehouse > 0) {
@@ -538,25 +537,25 @@ class Productbatch extends CommonObject
if ($qty_min !== null) {
$sql .= " AND pb.qty > ".((float) price2num($qty_min, 'MS'));
}
- $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $this->db->order($sortfield, $sortorder);
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
- while ($obj = $db->fetch_object($resql)) {
- $productBatch = new self($db);
+ while ($obj = $this->db->fetch_object($resql)) {
+ $productBatch = new self($this->db);
$productBatch->id = $obj->rowid;
$productBatch->fk_product = $obj->fk_product;
$productBatch->batch = $obj->batch;
- $productBatch->eatby = $db->jdate($obj->eatby);
- $productBatch->sellby = $db->jdate($obj->sellby);
+ $productBatch->eatby = $this->db->jdate($obj->eatby);
+ $productBatch->sellby = $this->db->jdate($obj->sellby);
$productBatch->qty = $obj->qty;
$productBatchList[] = $productBatch;
}
- $db->free($resql);
+ $this->db->free($resql);
return $productBatchList;
} else {
- dol_syslog(__METHOD__.' Error: '.$db->lasterror(), LOG_ERR);
+ dol_syslog(__METHOD__.' Error: '.$this->db->lasterror(), LOG_ERR);
return -1;
}
}
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index d5325029771..a6bb38adfe2 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -266,6 +266,11 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
+
+ print '';
+
print ' ';
$prodsfather = $object->getFather(); // Parent Products
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 3bf563c82f7..d4785f101cf 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -523,7 +523,9 @@ if ($id > 0 || $ref) {
$reshook = $hookmanager->executeHooks('formCreateThirdpartyOptions', $parameters, $object, $action);
if (empty($reshook)) {
if (empty($form->result)) {
- print ' - id.'&action='.$action).'">'.$langs->trans("CreateDolibarrThirdPartySupplier").'';
+ print 'id.'&action='.$action).'">';
+ print img_picto($langs->trans("CreateDolibarrThirdPartySupplier"), 'add', 'class="marginleftonly"');
+ print '';
}
}
}
@@ -665,7 +667,7 @@ if ($id > 0 || $ref) {
print '';
// Currency price qty min
- print '| '.$langs->trans("PriceQtyMinCurrency").' | ';
+ print ' | '.$form->textwithpicto($langs->trans("PriceQtyMinCurrency"), $langs->transnoentitiesnoconv("WithoutDiscount")).' | ';
$pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : ''));
print '';
print ' ';
@@ -673,7 +675,7 @@ if ($id > 0 || $ref) {
print ' | ';
// Price qty min
- print '| '.$langs->trans("PriceQtyMin").' | ';
+ print ' | '.$form->textwithpicto($langs->trans("PriceQtyMin"), $langs->transnoentitiesnoconv("WithoutDiscount")).' | ';
print '';
print '';
print '';
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index 23473545b11..b71047a5f47 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/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/product/inventory/list.php b/htdocs/product/inventory/list.php
index 41e43fdf433..c4548b3aa66 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -102,11 +102,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 9242c92ff4b..a3c6f0c582b 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -250,11 +250,11 @@ $arrayfields = array(
/*foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = dol_eval($val['visible'], 1);
+ $visible = dol_eval($val['visible'], 1, 1, '1');
$arrayfields['p.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position']
);
}
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 8389d63e843..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 {
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 8f24fb9c110..93c963e0065 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -117,11 +117,11 @@ $arrayfields = array(
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : 'help'
);
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/productlot_list.php b/htdocs/product/stock/productlot_list.php
index e5a8b05902e..92172643096 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -104,11 +104,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = dol_eval($val['visible'], 1);
+ $visible = dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position']
);
}
diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php
index b743dffbc53..c840ff3438a 100644
--- a/htdocs/projet/activity/perday.php
+++ b/htdocs/projet/activity/perday.php
@@ -349,7 +349,7 @@ $next_day = $next['mday'];
$title = $langs->trans("TimeSpent");
-$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
+$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, (empty($usertoprocess->id) ? 2 : 0), 1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
if ($id) {
$project->fetch($id);
@@ -476,12 +476,12 @@ if ($usertoprocess->id != $user->id) {
$titleassigntask = $langs->transnoentities("AssignTaskToUser", $usertoprocess->getFullName($langs));
}
print '';
-print img_picto('', 'projecttask');
+print img_picto('', 'projecttask', 'class="pictofixedwidth"');
$formproject->selectTasks($socid ? $socid : -1, $taskid, 'taskid', 32, 0, '-- '.$langs->trans("ChooseANotYetAssignedTask").' --', 1, 0, 0, '', '', 'all', $usertoprocess);
print ' ';
print ' ';
print $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid', 0, 'maxwidth150onsmartphone');
-print '';
+print '';
print '';
print '';
@@ -596,10 +596,10 @@ $extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
if (!empty($arrayfields['t.planned_workload']['checked'])) {
- print ''.$langs->trans("PlannedWorkload").' | ';
+ print ''.$langs->trans("PlannedWorkload").' | ';
}
if (!empty($arrayfields['t.progress']['checked'])) {
- print ''.$langs->trans("ProgressDeclared").' | ';
+ print 'trans("ProgressDeclared")).'">'.$langs->trans("ProgressDeclared").' | ';
}
if (!empty($arrayfields['timeconsumed']['checked'])) {
print ''.$langs->trans("TimeSpent").' ';
@@ -608,7 +608,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) {
print ''.$langs->trans("Everybody").'';
print '';
print ' | ';
- print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' '.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').' | ';
+ print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' '.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').' | ';
}
print ''.$langs->trans("HourStart").'';
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..591abb44181 100644
--- a/htdocs/projet/activity/perweek.php
+++ b/htdocs/projet/activity/perweek.php
@@ -119,6 +119,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
+// Definition of fields for list
$arrayfields = array();
/*$arrayfields=array(
// Project
@@ -257,7 +258,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 {
@@ -441,7 +442,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Show navigation bar
$nav = ''.img_previous($langs->trans("Previous"))."\n";
-$nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n";
+$nav .= ' '.dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("WeekShort")." ".$week." \n";
$nav .= ''.img_next($langs->trans("Next"))."\n";
$nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 1).' ';
$nav .= ' ';
@@ -652,10 +653,10 @@ $extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
if (!empty($arrayfields['t.planned_workload']['checked'])) {
- print ' | '.$langs->trans("PlannedWorkload").' | ';
+ print ''.$langs->trans("PlannedWorkload").' | ';
}
if (!empty($arrayfields['t.progress']['checked'])) {
- print ''.$langs->trans("ProgressDeclared").' | ';
+ print ''.$langs->trans("ProgressDeclared").' | ';
}
if (!empty($arrayfields['timeconsumed']['checked'])) {
print ''.$langs->trans("TimeSpent").' ';
@@ -664,7 +665,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) {
print ''.$langs->trans("Everybody").'';
print '';
print ' | ';
- print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' '.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').' | ';
+ print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? ' '.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').' | ';
}
for ($idw = 0; $idw < 7; $idw++) {
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
@@ -691,7 +692,7 @@ for ($idw = 0; $idw < 7; $idw++) {
$cssonholiday .= 'onholidayafternoon ';
}
- print '';
+ print ' | ';
print dol_print_date($dayinloopfromfirstdaytoshow, '%a');
print ' '.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').' | ';
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 328361c00c3..443e945aecb 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -27,6 +27,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 9e8d3a6ce8e..2301017edd9 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects', 'other'));
+$hookmanager->initHooks(array('projectcarddocument'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index c0afe5d1370..9b0544bccf6 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -62,6 +62,8 @@ if (GETPOST('actioncode', 'array')) {
}
$search_agenda_label = GETPOST('search_agenda_label');
+$hookmanager->initHooks(array('projectcardinfo'));
+
// Security check
$id = GETPOST("id", 'int');
$socid = 0;
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index b19bc407537..b254ac2b26f 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -183,11 +183,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = dol_eval($val['visible'], 1);
+ $visible = dol_eval($val['visible'], 1, 1, '1');
$arrayfields['p.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
@@ -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/stats/index.php b/htdocs/projet/tasks/stats/index.php
index 70c093f46e3..2ca72552fa4 100644
--- a/htdocs/projet/tasks/stats/index.php
+++ b/htdocs/projet/tasks/stats/index.php
@@ -180,7 +180,7 @@ print '
';
print '';
print ' ';
-print '';
+print ' ';
print '| '.$langs->trans("Year").' | ';
print ''.$langs->trans("NbOfTasks").' | ';
print ' ';
@@ -191,14 +191,14 @@ foreach ($data_all_year as $val) {
while ($year && $oldyear > $year + 1) { // If we have empty year
$oldyear--;
- print '';
- print '| 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$oldyear.' | ';
+ print ' ';
+ print '| 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$oldyear.' | ';
print '0 | ';
print ' ';
}
- print '';
- print '| 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.' | ';
+ print ' ';
+ print '| 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.' | ';
print ''.$val['nb'].' | ';
print ' ';
$oldyear = $year;
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 55303bcb00e..a7cdd1ceda8 100644
--- a/htdocs/public/eventorganization/attendee_new.php
+++ b/htdocs/public/eventorganization/attendee_new.php
@@ -56,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/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php
index 42cde055ac2..21fe3d9d7a1 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') {
@@ -286,10 +285,11 @@ print ' '."\n";
// show title of survey
$titre = str_replace("\\", "", $object->title);
-print ''.dol_htmlentities($titre).'
'."\n";
+print ''.dol_htmlentities($titre).'';
// show description of survey
if ($object->description) {
+ print '
'."\n";
print dol_htmlentitiesbr($object->description);
print ' '."\n";
}
@@ -781,9 +781,9 @@ if ($comments) {
if ($object->allow_comments) {
print '
| \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
@@ -1078,6 +1079,13 @@ if ($num == 0) {
print '| '.$langs->trans("NoRecordFound").' | ';
}
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
print " ";
print " ";
print '';
diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php
index c8ff1196c0f..1bfecac3f1d 100644
--- a/htdocs/reception/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php
@@ -25,7 +25,7 @@ if (empty($conf) || !is_object($conf)) {
?>
-
+
'."\n";
// Common attributes
diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php
index f16b8c3dcf9..05cf56636ea 100644
--- a/htdocs/recruitment/recruitmentcandidature_list.php
+++ b/htdocs/recruitment/recruitmentcandidature_list.php
@@ -151,11 +151,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = dol_eval($val['visible'], 1);
+ $visible = dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position']
);
}
diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php
index a61665de070..3bf5fb94073 100644
--- a/htdocs/recruitment/recruitmentjobposition_list.php
+++ b/htdocs/recruitment/recruitmentjobposition_list.php
@@ -158,11 +158,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php
index 7a8b3ebca10..2e77c29cd01 100644
--- a/htdocs/salaries/list.php
+++ b/htdocs/salaries/list.php
@@ -134,11 +134,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
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/salaries/payments.php b/htdocs/salaries/payments.php
index 77cbae397f0..58f5546216f 100644
--- a/htdocs/salaries/payments.php
+++ b/htdocs/salaries/payments.php
@@ -129,11 +129,11 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) {
- $visible = (int) dol_eval($val['visible'], 1);
+ $visible = (int) dol_eval($val['visible'], 1, 1, '1');
$arrayfields['t.'.$key] = array(
'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
+ 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
'position'=>$val['position'],
'help'=> isset($val['help']) ? $val['help'] : ''
);
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 236551c1c2e..55161f42e09 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -626,7 +626,7 @@ foreach ($dirsociete as $dirroot) {
// Preview
print '';
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');
}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index fc273205aef..89eeeaca8e5 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...)
*/
@@ -2529,9 +2530,10 @@ class Societe extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $noaliasinname 1=Do not add alias into the link ref
+ * @param string $target add attribute target
* @return string String with URL
*/
- public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0)
+ public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '')
{
global $conf, $langs, $hookmanager;
@@ -2573,7 +2575,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 +2643,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 : '');
@@ -2703,6 +2706,10 @@ class Societe extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip refurl"';
+ $target_value = array('_self', '_blank', '_parent', '_top');
+ if (in_array($target, $target_value)) {
+ $linkclose .= ' target="'.dol_escape_htmltag($target).'"';
+ }
/*
$hookmanager->initHooks(array('thirdpartydao'));
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 " | ";
- 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 " | \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/takepos/invoice.php b/htdocs/takepos/invoice.php
index 66a75ef7050..3453d0e0579 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -912,6 +912,7 @@ $form = new Form($db);
| |
|