'.$CrLf);
@@ -1854,16 +1854,16 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
- $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom)))).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ''))).' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$row_country_code.' '.$CrLf;
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) {
- $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if (trim($addressline2)) {
- $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_DEBITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_DEBITOR .= ' '.$CrLf;
$XML_DEBITOR .= ' '.$CrLf;
@@ -1929,10 +1929,10 @@ class BonPrelevement extends CommonObject
$addressline1 = strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => ""));
if (trim($addressline1)) {
- $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if (trim($addressline2)) {
- $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_CREDITOR .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_CREDITOR .= ' '.$CrLf;
$XML_CREDITOR .= ' '.$CrLf;
@@ -2096,16 +2096,16 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$dateTime_ETAD.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if ($addressline2) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
@@ -2123,8 +2123,8 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;*/
$XML_SEPA_INFO .= ' SLEV '.$CrLf; // Field "Responsible of fees". Must be SLEV
@@ -2162,16 +2162,16 @@ class BonPrelevement extends CommonObject
}
$XML_SEPA_INFO .= ' '.dol_print_date($dateTime_ETAD, 'dayrfc').' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ''))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => ""));
$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => ""));
if ($addressline1) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
if ($addressline2) {
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2)), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ''), 70, 'right', 'UTF-8', 1)).' '.$CrLf;
}
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
@@ -2189,8 +2189,8 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale)))).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS))).' '.$CrLf;
- $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN)).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), '')).' '.$CrLf;
+ $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), '')).' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;*/
$XML_SEPA_INFO .= ' SLEV '.$CrLf; // Field "Responsible of fees". Must be SLEV
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 09d46d02b13..67b144ffd89 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -1271,7 +1271,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' '.$langs->trans("Delete").' ';
}
//print ''.$langs->trans("PhotoFile").' ';
- print ' ';
+ print '';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ print ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ print ' ';
+ print ' ';
print '';
print '';
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index e90f8b46bd0..6030fc1e6bd 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -159,7 +159,14 @@ if ($action == 'edit') {
print ' '.$langs->trans("Delete").' ';
}
print ''.$langs->trans("PhotoFile").' ';
- print ' ';
+ print '';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ print ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ print ' ';
+ print ' ';
print '';
print '';
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index ecc8ec22660..0f61ecada43 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1415,7 +1415,7 @@ if ($action == 'create') {
}
- $arrayothercontracts = $object->getListOfContracts('others');
+ $arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error
/*
* Lines of contracts
@@ -1544,9 +1544,9 @@ if ($action == 'create') {
print ''.price($objp->pa_ht).' ';
}
- // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
+ // Icon move, update et delete (status contract 0=draft,1=validated,2=closed)
print '';
- if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) {
+ if ($user->rights->contrat->creer && is_array($arrayothercontracts) && count($arrayothercontracts) && ($object->statut >= 0)) {
print '';
print '';
print img_picto($langs->trans("MoveToAnotherContract"), 'uparrow');
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 8b6d7490eaf..ee59a5465dc 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -1058,7 +1058,7 @@ class Contrat extends CommonObject
if (count($exp->linkedObjectsIds['commande']) > 0) {
foreach ($exp->linkedObjectsIds['commande'] as $key => $value) {
$originforcontact = 'commande';
- $originidforcontact = $value->id;
+ $originidforcontact = $value;
break; // We take first one
}
}
@@ -2126,7 +2126,7 @@ class Contrat extends CommonObject
}
/**
- * Return list of other contracts for same company than current contract
+ * Return list of other contracts for the same company than current contract
*
* @param string $option 'all' or 'others'
* @param array $status sort contracts having these status
@@ -2138,7 +2138,7 @@ class Contrat extends CommonObject
{
$tab = array();
- $sql = "SELECT c.rowid, c.ref";
+ $sql = "SELECT c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
if (!empty($product_categories)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON cd.fk_contrat = c.rowid";
@@ -2159,12 +2159,12 @@ class Contrat extends CommonObject
$obj = $this->db->fetch_object($resql);
$contrat = new Contrat($this->db);
$contrat->fetch($obj->rowid);
- $tab[] = $contrat;
+ $tab[$contrat->id] = $contrat;
$i++;
}
return $tab;
} else {
- $this->error = $this->db->error();
+ $this->error = $this->db->lasterror();
return -1;
}
}
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 969d590be34..506a1465fdc 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -266,7 +266,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$action = 'view';
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
- if ($urltogo) {
+ if ($urltogo && !$noback) {
header("Location: " . $urltogo);
exit;
}
diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php
index f2195659654..cd610543e47 100644
--- a/htdocs/core/boxes/box_scheduled_jobs.php
+++ b/htdocs/core/boxes/box_scheduled_jobs.php
@@ -63,7 +63,7 @@ class box_scheduled_jobs extends ModeleBoxes
$this->db = $db;
- $this->hidden = !($user->rights->service->lire && $user->rights->contrat->lire);
+ $this->hidden = !($user->hasRight('service', 'lire') && $user->hasRight('contrat', 'lire'));
}
/**
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 06d352441be..e96eee5c553 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -168,17 +168,18 @@ abstract class CommonInvoice extends CommonObject
/**
* Return amount (with tax) of all deposits invoices used by invoice.
- * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
+ * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended),
+ * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended).
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return float <0 and set ->error if KO, Sum of deposits amount otherwise
*/
public function getSumDepositsUsed($multicurrency = 0)
{
- if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
+ /*if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') {
// FACTURE_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case.
return 0.0;
- }
+ }*/
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
@@ -899,6 +900,101 @@ abstract class CommonInvoice extends CommonObject
return $s;
}
+
+
+ /**
+ * Build string for QR-Bill (Switzerland)
+ *
+ * @return string String for Switzerland QR Code if QR-Bill
+ */
+ public function buildSwitzerlandQRString()
+ {
+ global $conf, $mysoc;
+
+ $tmplang = new Translate('', $conf);
+ $tmplang->setDefaultLang('en_US');
+ $tmplang->load("main");
+
+ $pricewithtaxstring = price2num($this->total_ttc, 2, 1);
+ $pricetaxstring = price2num($this->total_tva, 2, 1);
+
+ $complementaryinfo = '';
+ /*
+ Example: //S1/10/10201409/11/190512/20/1400.000-53/30/106017086/31/180508/32/7.7/40/2:10;0:30
+ /10/ Numéro de facture – 10201409
+ /11/ Date de facture – 12.05.2019
+ /20/ Référence client – 1400.000-53
+ /30/ Numéro IDE pour la TVA – CHE-106.017.086 TVA
+ /31/ Date de la prestation pour la comptabilisation de la TVA – 08.05.2018
+ /32/ Taux de TVA sur le montant total de la facture – 7.7%
+ /40/ Conditions – 2% d’escompte à 10 jours, paiement net à 30 jours
+ */
+ $datestring = dol_print_date($this->date, '%y%m%d');
+ //$pricewithtaxstring = price($this->total_ttc, 0, $tmplang, 0, -1, 2);
+ //$pricetaxstring = price($this->total_tva, 0, $tmplang, 0, -1, 2);
+ $complementaryinfo = '//S1/10/'.str_replace('/', '', $this->ref).'/11/'.$datestring;
+ if ($this->ref_client) {
+ $complementaryinfo .= '/20/'.$this->ref_client;
+ }
+ if ($this->thirdparty->vat_number) {
+ $complementaryinfo .= '/30/'.$this->thirdparty->vat_number;
+ }
+
+ // Header
+ $s .= "SPC\n";
+ $s .= "0200\n";
+ $s .= "1\n";
+ if ($this->fk_account > 0) {
+ // Bank BAN if country is LI or CH
+ // TODO Add
+ $bankaccount = new Account($this->db);
+ $bankaccount->fetch($this->fk_account);
+ $s .= $bankaccount->iban."\n";
+ } else {
+ $s .= "\n";
+ }
+ // Seller
+ $s .= "S\n";
+ $s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";
+ $addresslinearray = explode("\n", $mysoc->address);
+ $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
+ $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
+ $s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
+ $s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
+ $s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";
+ // Final seller
+ $s .= "\n";
+ $s .= "\n";
+ $s .= "\n";
+ $s .= "\n";
+ $s .= "\n";
+ $s .= "\n";
+ $s .= "\n";
+ // Amount of payment (to do?)
+ $s .= price($pricewithtaxstring, 0, 'none', 0, 0, 2)."\n";
+ $s .= ($this->multicurrency_code ? $this->multicurrency_code : $conf->currency)."\n";
+ // Buyer
+ $s .= "S\n";
+ $s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n";
+ $addresslinearray = explode("\n", $this->thirdparty->address);
+ $s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
+ $s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
+ $s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n";
+ $s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n";
+ $s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n";
+ // ID of payment
+ $s .= "NON\n"; // NON or QRR
+ $s .= "\n"; // QR Code if previous field is QRR
+ if ($complementaryinfo) {
+ $s .= $complementaryinfo."\n";
+ } else {
+ $s .= "\n";
+ }
+ $s .= "EPD\n";
+ $s .= "\n";
+ //var_dump($s);exit;
+ return $s;
+ }
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 9b8fea19e5f..4a95bb7d345 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -186,6 +186,12 @@ abstract class CommonObject
*/
public $projet;
+ /**
+ * @deprecated
+ * @see fk_project
+ */
+ public $fk_projet;
+
/**
* @var Contact a related contact
* @see fetch_contact()
@@ -272,7 +278,7 @@ abstract class CommonObject
public $country_id;
/**
- * @var string
+ * @var string The ISO country code on 2 chars.
* @see getFullAddress(), isInEEC(), country
*/
public $country_code;
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 602e6b560d0..0a996018e97 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -746,8 +746,8 @@ class Conf
$this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT = 1; // allow html content into free footer text
}
- // Default max file size for upload
- $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
+ // Default max file size for upload (deprecated)
+ //$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
// By default, we propagate contacts
if (!isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) {
diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php
index 7ae9e5fcd90..c42612afda8 100644
--- a/htdocs/core/class/evalmath.class.php
+++ b/htdocs/core/class/evalmath.class.php
@@ -144,6 +144,10 @@ class EvalMath
*/
public function evaluate($expr)
{
+ if (empty($expr)) {
+ return false;
+ }
+
$this->last_error = null;
$this->last_error_code = null;
$expr = trim($expr);
@@ -374,10 +378,6 @@ class EvalMath
*/
private function pfx($tokens, $vars = array())
{
- if ($tokens == false) {
- return false;
- }
-
$stack = new EvalMathStack();
foreach ($tokens as $token) { // nice and easy
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 4f9b0d06f16..625e473e7e6 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -60,6 +60,11 @@ class ExtraFields
*/
public $attribute_choice;
+ /**
+ * @var array array to store extrafields definition
+ * @deprecated
+ */
+ public $attribute_list;
/**
* @var array New array to store extrafields definition
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 56990effeb2..88f7f7aaa9a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4749,7 +4749,7 @@ class Form
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
if ($nbaccountfound > 0) {
- print ' ';
+ print ' ';
}
print '';
} else {
@@ -4901,9 +4901,11 @@ class Form
* @param int|string $height Force height of box (0 = auto)
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a ';
}
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 97f5eca5822..9ba4ccc7f19 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -148,64 +148,15 @@ class FormFile
$out .= ' ';
- $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
- $maxphp = @ini_get('upload_max_filesize'); // In unknown
- if (preg_match('/k$/i', $maxphp)) {
- $maxphp = preg_replace('/k$/i', '', $maxphp);
- $maxphp = $maxphp * 1;
- }
- if (preg_match('/m$/i', $maxphp)) {
- $maxphp = preg_replace('/m$/i', '', $maxphp);
- $maxphp = $maxphp * 1024;
- }
- if (preg_match('/g$/i', $maxphp)) {
- $maxphp = preg_replace('/g$/i', '', $maxphp);
- $maxphp = $maxphp * 1024 * 1024;
- }
- if (preg_match('/t$/i', $maxphp)) {
- $maxphp = preg_replace('/t$/i', '', $maxphp);
- $maxphp = $maxphp * 1024 * 1024 * 1024;
- }
- $maxphp2 = @ini_get('post_max_size'); // In unknown
- if (preg_match('/k$/i', $maxphp2)) {
- $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
- $maxphp2 = $maxphp2 * 1;
- }
- if (preg_match('/m$/i', $maxphp2)) {
- $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
- $maxphp2 = $maxphp2 * 1024;
- }
- if (preg_match('/g$/i', $maxphp2)) {
- $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
- $maxphp2 = $maxphp2 * 1024 * 1024;
- }
- if (preg_match('/t$/i', $maxphp2)) {
- $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
- $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
- }
- // Now $max and $maxphp and $maxphp2 are in Kb
- $maxmin = $max;
- $maxphptoshow = $maxphptoshowparam = '';
- if ($maxphp > 0) {
- $maxmin = min($max, $maxphp);
- $maxphptoshow = $maxphp;
- $maxphptoshowparam = 'upload_max_filesize';
- }
- if ($maxphp2 > 0) {
- $maxmin = min($max, $maxphp2);
- if ($maxphp2 < $maxphp) {
- $maxphptoshow = $maxphp2;
- $maxphptoshowparam = 'post_max_size';
- }
- }
-
+ $maxfilesizearray = getMaxFileSizeArray();
+ $max = $maxfilesizearray['max'];
+ $maxmin = $maxfilesizearray['maxmin'];
+ $maxphptoshow = $maxfilesizearray['maxphptoshow'];
+ $maxphptoshowparam = $maxfilesizearray['maxphptoshowparam'];
if ($maxmin > 0) {
- // MAX_FILE_SIZE doit précéder le champ input de type file
- $out .= ' ';
+ $out .= ' '; // MAX_FILE_SIZE must precede the field type=file
}
-
$out .= ' global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 27ef700cd09..f2697bc3873 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -829,6 +829,11 @@ class FormMail extends Form
$out .= ''.$langs->trans("NoAttachedFiles").' ';
}
if ($this->withfile == 2) {
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $out .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
// Can add other files
if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) {
$out .= ' ';
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index 4e0d3da467e..5bee2f31dd4 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -700,11 +700,14 @@ class FormOther
print ' selected';
}
- $labeltoshow = $langs->trans("Project").' '.$lines[$i]->projectref;
+ $labeltoshow = $lines[$i]->projectref;
+ //$labeltoshow .= ' '.$lines[$i]->projectlabel;
if (empty($lines[$i]->public)) {
- $labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").') ';
+ //$labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").') ';
+ $labeltoshow = img_picto($lines[$i]->projectlabel, 'project', 'class="pictofixedwidth"').$labeltoshow;
} else {
- $labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").') ';
+ //$labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").') ';
+ $labeltoshow = img_picto($lines[$i]->projectlabel, 'projectpub', 'class="pictofixedwidth"').$labeltoshow;
}
print ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
@@ -738,12 +741,14 @@ class FormOther
print ' disabled';
}
- $labeltoshow = $langs->trans("Project").' '.$lines[$i]->projectref;
- $labeltoshow .= ' '.$lines[$i]->projectlabel;
+ $labeltoshow = $lines[$i]->projectref;
+ //$labeltoshow .= ' '.$lines[$i]->projectlabel;
if (empty($lines[$i]->public)) {
- $labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").') ';
+ //$labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").') ';
+ $labeltoshow = img_picto($lines[$i]->projectlabel, 'project', 'class="pictofixedwidth"').$labeltoshow;
} else {
- $labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").') ';
+ //$labeltoshow .= ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").') ';
+ $labeltoshow = img_picto($lines[$i]->projectlabel, 'projectpub', 'class="pictofixedwidth"').$labeltoshow;
}
if ($lines[$i]->id) {
$labeltoshow .= ' > ';
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index f1c6e12e925..d837cf06030 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -491,6 +491,11 @@ class FormTicket
$out .= $langs->trans("NoAttachedFiles").' ';
}
if ($this->withfile == 2) { // Can add other files
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $out .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
$out .= ' ';
$out .= ' ';
$out .= ' ';
diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php
index ae9a8e56e58..49a2c6d4403 100644
--- a/htdocs/core/class/stats.class.php
+++ b/htdocs/core/class/stats.class.php
@@ -33,6 +33,13 @@ abstract class Stats
protected $lastfetchdate = array(); // Dates of cache file read by methods
public $cachefilesuffix = ''; // Suffix to add to name of cache file (to avoid file name conflicts)
+ /**
+ * @param int $year number
+ * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
+ * @return int value
+ */
+ protected abstract function getNbByMonth($year, $format = 0);
+
/**
* Return nb of elements by month for several years
*
@@ -123,6 +130,13 @@ abstract class Stats
return $data;
}
+ /**
+ * @param int $year year number
+ * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
+ * @return int value
+ */
+ protected abstract function getAmountByMonth($year, $format = 0);
+
/**
* Return amount of elements by month for several years.
* Criterias used to build request are defined into the constructor of parent class into xxx/class/xxxstats.class.php
@@ -460,7 +474,6 @@ abstract class Stats
return $data;
}
-
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return the amount per month for a given year
diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php
index ac4c14f7937..9d8832c36ce 100644
--- a/htdocs/core/class/validate.class.php
+++ b/htdocs/core/class/validate.class.php
@@ -300,13 +300,13 @@ class Validate
/**
* Check for all values in db
*
- * @param array $values Boolean to validate
+ * @param integer $id of element
* @param string $classname the class name
* @param string $classpath the class path
* @return boolean Validity is ok or not
* @throws Exception
*/
- public function isFetchable($values, $classname, $classpath)
+ public function isFetchable($id, $classname, $classpath)
{
if (!empty($classpath)) {
if (dol_include_once($classpath)) {
@@ -319,7 +319,7 @@ class Validate
return false;
}
- if (!empty($object->table_element) && $object->isExistingObject($object->table_element, $values)) {
+ if (!empty($object->table_element) && $object->isExistingObject($object->table_element, $id)) {
return true;
} else { $this->error = $this->outputLang->trans('RequireValidExistingElement'); }
} else { $this->error = $this->outputLang->trans('BadSetupOfFieldClassNotFoundForValidation'); }
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 13d44e1ec8a..bf41b5a624a 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -132,6 +132,9 @@ function getEntity($element, $shared = 1, $currentobject = null)
case 'order_supplier':
$element = 'supplier_order';
break; // "/fourn/class/fournisseur.commande.class.php"
+ case 'invoice_supplier':
+ $element = 'supplier_invoice';
+ break; // "/fourn/class/fournisseur.facture.class.php"
}
if (is_object($mc)) {
@@ -2246,6 +2249,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
}
+ // Show address and email
if (method_exists($object, 'getBannerAddress') && !in_array($object->element, array('product', 'bookmark', 'ecm_directories', 'ecm_files'))) {
$moreaddress = $object->getBannerAddress('refaddress', $object);
if ($moreaddress) {
@@ -2950,6 +2954,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
//$rep .= '';
if ($hookmanager) {
$parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);
+
$reshook = $hookmanager->executeHooks('printEmail', $parameters, $email);
if ($reshook > 0) {
$rep = '';
@@ -5464,7 +5469,7 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
*
* @param float $amount Amount to format
* @param integer $form Type of format, HTML or not (not by default)
- * @param Translate|string $outlangs Object langs for output
+ * @param Translate|string $outlangs Object langs for output. '' use default lang. 'none' use international separators.
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
* @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
@@ -5487,25 +5492,31 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
}
$nbdecimal = $rounding;
- // Output separators by default (french)
- $dec = ',';
- $thousand = ' ';
-
- // If $outlangs not forced, we use use language
- if (!is_object($outlangs)) {
- $outlangs = $langs;
- }
-
- if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
- $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal");
- }
- if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
- $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand");
- }
- if ($thousand == 'None') {
+ if ($outlangs === 'none') {
+ // Use international separators
+ $dec = '.';
$thousand = '';
- } elseif ($thousand == 'Space') {
+ } else {
+ // Output separators by default (french)
+ $dec = ',';
$thousand = ' ';
+
+ // If $outlangs not forced, we use use language
+ if (!is_object($outlangs)) {
+ $outlangs = $langs;
+ }
+
+ if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
+ $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal");
+ }
+ if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
+ $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand");
+ }
+ if ($thousand == 'None') {
+ $thousand = '';
+ } elseif ($thousand == 'Space') {
+ $thousand = ' ';
+ }
}
//print "outlangs=".$outlangs->defaultlang." amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."' ";
@@ -5544,7 +5555,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
}
// Add symbol of currency if requested
$cursymbolbefore = $cursymbolafter = '';
- if ($currency_code) {
+ if ($currency_code && is_object($outlangs)) {
if ($currency_code == 'auto') {
$currency_code = $conf->currency;
}
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index d53870128fc..c820e260b4e 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -650,7 +650,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($showproject) {
// Project ref
- print " ";
+ print ' ';
//if ($showlineingray) print '';
if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) {
print $projectstatic->getNomUrl(1);
@@ -701,21 +701,21 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
if (count($arrayfields) > 0 && !empty($arrayfields['t.description']['checked'])) {
- print " ";
+ print ' ';
print $lines[$i]->description;
print " \n";
}
// Date start
if (count($arrayfields) > 0 && !empty($arrayfields['t.dateo']['checked'])) {
- print '';
+ print ' ';
print dol_print_date($lines[$i]->date_start, 'dayhour');
print ' ';
}
// Date end
if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) {
- print '';
+ print ' ';
print dol_print_date($lines[$i]->date_end, 'dayhour');
if ($taskstatic->hasDelay()) {
print img_warning($langs->trans("Late"));
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 056d28ab2cd..1d3f013e9f3 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -977,3 +977,70 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
}
exit(0);
}
+
+
+/**
+ * Return the max allowed for file upload.
+ * Analyze among: upload_max_filesize, post_max_size, MAIN_UPLOAD_DOC
+ *
+ * @return array Array with all max size for file upload
+ */
+function getMaxFileSizeArray()
+{
+ global $conf;
+
+ $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
+ $maxphp = @ini_get('upload_max_filesize'); // In unknown
+ if (preg_match('/k$/i', $maxphp)) {
+ $maxphp = preg_replace('/k$/i', '', $maxphp);
+ $maxphp = $maxphp * 1;
+ }
+ if (preg_match('/m$/i', $maxphp)) {
+ $maxphp = preg_replace('/m$/i', '', $maxphp);
+ $maxphp = $maxphp * 1024;
+ }
+ if (preg_match('/g$/i', $maxphp)) {
+ $maxphp = preg_replace('/g$/i', '', $maxphp);
+ $maxphp = $maxphp * 1024 * 1024;
+ }
+ if (preg_match('/t$/i', $maxphp)) {
+ $maxphp = preg_replace('/t$/i', '', $maxphp);
+ $maxphp = $maxphp * 1024 * 1024 * 1024;
+ }
+ $maxphp2 = @ini_get('post_max_size'); // In unknown
+ if (preg_match('/k$/i', $maxphp2)) {
+ $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
+ $maxphp2 = $maxphp2 * 1;
+ }
+ if (preg_match('/m$/i', $maxphp2)) {
+ $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
+ $maxphp2 = $maxphp2 * 1024;
+ }
+ if (preg_match('/g$/i', $maxphp2)) {
+ $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
+ $maxphp2 = $maxphp2 * 1024 * 1024;
+ }
+ if (preg_match('/t$/i', $maxphp2)) {
+ $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
+ $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
+ }
+ // Now $max and $maxphp and $maxphp2 are in Kb
+ $maxmin = $max;
+ $maxphptoshow = $maxphptoshowparam = '';
+ if ($maxphp > 0) {
+ $maxmin = min($maxmin, $maxphp);
+ $maxphptoshow = $maxphp;
+ $maxphptoshowparam = 'upload_max_filesize';
+ }
+ if ($maxphp2 > 0) {
+ $maxmin = min($maxmin, $maxphp2);
+ if ($maxphp2 < $maxphp) {
+ $maxphptoshow = $maxphp2;
+ $maxphptoshowparam = 'post_max_size';
+ }
+ }
+ //var_dump($maxphp.'-'.$maxphp2);
+ //var_dump($maxmin);
+
+ return array('max'=>$max, 'maxmin'=>$maxmin, 'maxphptoshow'=>$maxphptoshow, 'maxphptoshowparam'=>$maxphptoshowparam);
+}
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index 23917c4b79c..43bf3ecd2cb 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -174,7 +174,13 @@ class doc_generic_bom_odt extends ModelePDFBom
$texte .= '';
}
// Add input to upload a new template file.
- $texte .= '';
}
// Add input to upload a new template file.
- $texte .= ''.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index bdda6f26862..cb73b6fc282 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -611,6 +611,9 @@ class pdf_einstein extends ModelePDFCommandes
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index b2d0c1c0f30..8930481d219 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -835,6 +835,9 @@ class pdf_eratosthene extends ModelePDFCommandes
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == $pageposafter) {
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index 23ed4bec34a..9050e1accf5 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -166,7 +166,13 @@ class doc_generic_contract_odt extends ModelePDFContract
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index 4dbad109cf4..1875cfb833c 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -437,6 +437,9 @@ class pdf_strato extends ModelePDFContract
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
index 9c588fdf55e..7d880328663 100644
--- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
@@ -574,6 +574,9 @@ class pdf_storm extends ModelePDFDeliveryOrder
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
index a9537b324f1..2e0c3f2d05c 100644
--- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
@@ -498,6 +498,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index 209acf648d6..f2035c89575 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -180,7 +180,13 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index 982a63dade8..3a8defb8db4 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -708,6 +708,9 @@ class pdf_espadon extends ModelePdfExpedition
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index e1da387d1ad..ab9461d104f 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -614,6 +614,9 @@ class pdf_rouget extends ModelePdfExpedition
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index 6dae41ca2af..43c1ae9e4de 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -450,6 +450,9 @@ class pdf_standard extends ModeleExpenseReport
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index 07a1e3966a6..fc73460bd1b 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -179,7 +179,13 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 1bb5400acc7..63e9d61c409 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -452,8 +452,13 @@ class pdf_crabe extends ModelePDFFactures
// You can add more thing under header here, if you increase $extra_under_address_shift too.
$extra_under_address_shift = 0;
+ $qrcodestring = '';
if (! empty($conf->global->INVOICE_ADD_ZATCA_QR_CODE)) {
$qrcodestring = $object->buildZATCAQRString();
+ } elseif (! empty($conf->global->INVOICE_ADD_SWISS_QR_CODE)) {
+ $qrcodestring = $object->buildSwitzerlandQRString();
+ }
+ if ($qrcodestring) {
$qrcodecolor = array('25', '25', '25');
// set style for QR-code
$styleQr = array(
@@ -795,6 +800,9 @@ class pdf_crabe extends ModelePDFFactures
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index bc4dad25f91..46ac4ffde37 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -435,8 +435,13 @@ class pdf_sponge extends ModelePDFFactures
// You can add more thing under header here, if you increase $extra_under_address_shift too.
$extra_under_address_shift = 0;
+ $qrcodestring = '';
if (! empty($conf->global->INVOICE_ADD_ZATCA_QR_CODE)) {
$qrcodestring = $object->buildZATCAQRString();
+ } elseif (! empty($conf->global->INVOICE_ADD_SWISS_QR_CODE)) {
+ $qrcodestring = $object->buildSwitzerlandQRString();
+ }
+ if ($qrcodestring) {
$qrcodecolor = array('25', '25', '25');
// set style for QR-code
$styleQr = array(
@@ -929,6 +934,9 @@ class pdf_sponge extends ModelePDFFactures
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index 8c07dbb64f3..bb4a6826278 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -418,6 +418,9 @@ class pdf_soleil extends ModelePDFFicheinter
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php
index 9a80484f83b..d698a646371 100644
--- a/htdocs/core/modules/mailings/xinputfile.modules.php
+++ b/htdocs/core/modules/mailings/xinputfile.modules.php
@@ -110,6 +110,11 @@ class mailing_xinputfile extends MailingTargets
global $langs;
$s = '';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $s .= '
'; // MAX_FILE_SIZE must precede the field type=file
+ }
$s .= '
';
return $s;
}
diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
index fb084f312fe..0b64203798f 100644
--- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
+++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
@@ -169,7 +169,13 @@ class doc_generic_member_odt extends ModelePDFMember
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php
index 80a6ff1a805..2cdc8229e51 100644
--- a/htdocs/core/modules/modFacture.class.php
+++ b/htdocs/core/modules/modFacture.class.php
@@ -134,7 +134,7 @@ class modFacture extends DolibarrModules
'objectname'=>'Facture',
'method'=>'sendEmailsRemindersOnInvoiceDueDate',
'parameters'=>"10,all,EmailTemplateCode",
- 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last parameter is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).',
+ 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last parameter is the code of email template to use (an email template with EmailTemplateCode must exists. The version in the language of the thirdparty will be used in priority to update the PDF of the sent invoice).',
'frequency'=>1,
'unitfrequency'=>3600 * 24,
'priority'=>50,
diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
index f597f580b47..f83b6efa1ed 100644
--- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
@@ -675,6 +675,9 @@ class pdf_standard extends ModelePDFMovement
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
index 090a45f4b3f..5d228da7d8c 100644
--- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
+++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
@@ -177,7 +177,13 @@ class doc_generic_product_odt extends ModelePDFProduct
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
index bb6eb75bf75..df013a2fad0 100644
--- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
@@ -470,6 +470,9 @@ class pdf_baleine extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index 4aa6f754ad9..fba5e02b098 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -743,6 +743,9 @@ class pdf_beluga extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
}
diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
index 741476de117..9d118b2a555 100644
--- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
@@ -473,6 +473,9 @@ class pdf_timespent extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 39ffd92ac5e..6f91d676949 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -211,7 +211,13 @@ class doc_generic_proposal_odt extends ModelePDFPropales
}
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 511677d742b..177443153ce 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -726,6 +726,9 @@ class pdf_azur extends ModelePDFPropales
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
index 47af81d8aa2..1ed76728b92 100644
--- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
@@ -850,6 +850,9 @@ class pdf_cyan extends ModelePDFPropales
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index 3e48aaf18bc..1976dea773f 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -173,7 +173,13 @@ class doc_generic_reception_odt extends ModelePdfReception
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
index ecbeccb5a61..3fd3917da2d 100644
--- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
@@ -460,6 +460,9 @@ class pdf_standard extends ModelePDFStock
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
index da8c1f4ac26..233d18ce229 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
@@ -777,6 +777,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == $pageposafter) {
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
index c7dc161330c..5498800aefc 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
@@ -659,6 +659,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
index 4e1027207a7..6919ffe69aa 100644
--- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
@@ -420,6 +420,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
index 6b47240016f..70ee5d75710 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -659,6 +659,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
+ if (!empty($tplidx)) {
+ $pdf->useTemplate($tplidx);
+ }
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
index d69da78aacc..cf358cae606 100644
--- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
+++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
@@ -166,7 +166,13 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
';
}
// Add input to upload a new template file.
- $texte .= '
'.$langs->trans("UploadNewTemplate").'
';
+ $texte .= '
'.$langs->trans("UploadNewTemplate");
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ $texte .= ' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
diff --git a/htdocs/core/tpl/ajax/fileupload_view.tpl.php b/htdocs/core/tpl/ajax/fileupload_view.tpl.php
index 70182a17dbc..22f8d687db0 100644
--- a/htdocs/core/tpl/ajax/fileupload_view.tpl.php
+++ b/htdocs/core/tpl/ajax/fileupload_view.tpl.php
@@ -37,6 +37,13 @@ if (empty($conf) || !is_object($conf)) {
trans('AddFiles'); ?>
+ 0) {
+ print ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
+ ?>
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index 1072f68b48f..c8cb251ea46 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -353,6 +353,10 @@ if ($action == 'execute') {
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1);
}
+if ($action == 'delete') {
+ print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1);
+}
+
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php
index 15bb2360ed8..af824a64392 100644
--- a/htdocs/debugbar/class/DebugBar.php
+++ b/htdocs/debugbar/class/DebugBar.php
@@ -40,7 +40,7 @@ class DolibarrDebugBar extends DebugBar
//$this->addCollector(new DolExceptionsCollector());
$this->addCollector(new DolQueryCollector());
$this->addCollector(new DolibarrCollector());
- if ($conf->syslog->enabled) {
+ if (isModEnabled('syslog')) {
$this->addCollector(new DolLogsCollector());
}
}
diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php
index 2c43cd715a3..9edc080701b 100644
--- a/htdocs/delivery/class/delivery.class.php
+++ b/htdocs/delivery/class/delivery.class.php
@@ -106,6 +106,8 @@ class Delivery extends CommonObject
*/
public $model_pdf;
+ public $commande_id;
+
public $lines = array();
diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php
index 5ce35541a16..5c7681a3782 100644
--- a/htdocs/emailcollector/class/emailcollectoraction.class.php
+++ b/htdocs/emailcollector/class/emailcollectoraction.class.php
@@ -271,9 +271,9 @@ class EmailCollectorAction extends CommonObject
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
- if ($result > 0 && !empty($this->table_element_line)) {
- $this->fetchLines();
- }
+ // if ($result > 0 && !empty($this->table_element_line)) {
+ // $this->fetchLinesCommon();
+ // }
return $result;
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 09411f29d50..fd07a30f648 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -1062,9 +1062,7 @@ if ($action == 'create') {
print '';
}
} elseif ($id > 0 || !empty($ref)) {
- /*
- * Affichage en mode visu
- */
+ // View mode
$object->fetch($id, $ref);
$object->fetch_thirdparty();
@@ -1201,7 +1199,7 @@ if ($action == 'create') {
print '';
print '
';
- print '
';
+ print '';
if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES)) {
// Date Start
@@ -1230,7 +1228,7 @@ if ($action == 'create') {
print '';
print $form->editfieldkey("Description", 'description', $object->description, $object, $user->rights->ficheinter->creer, 'textarea');
print ' ';
- print $form->editfieldval("Description", 'description', $object->description, $object, $user->rights->ficheinter->creer, 'textarea:8:80');
+ print $form->editfieldval("Description", 'description', $object->description, $object, $user->rights->ficheinter->creer, 'textarea:8');
print ' ';
print ' ';
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 2d649589282..fb89cd2c455 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -70,7 +70,7 @@ $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('suppliercard', 'globalcard'));
+$hookmanager->initHooks(array('thirdpartysupplier', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
@@ -147,6 +147,7 @@ if (empty($reshook)) {
if (!$error) {
$result = $object->insertExtraFields('COMPANY_MODIFY');
if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
@@ -170,6 +171,7 @@ if ($id > 0 && empty($object->id)) {
$res = $object->fetch($id);
if ($object->id <= 0) {
dol_print_error($db, $object->error);
+ exit(-1);
}
}
diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php
index fe9c00c75f3..31bc37b6e1a 100644
--- a/htdocs/fourn/class/fournisseur.facture-rec.class.php
+++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php
@@ -564,7 +564,7 @@ class FactureFournisseurRec extends CommonInvoice
$sql .= ', f.vat_src_code, f.localtax1, f.localtax2';
$sql .= ', f.total_tva, f.total_ht, f.total_ttc';
$sql .= ', f.fk_user_author, f.fk_user_modif';
- $sql .= ', f.fk_projet, f.fk_account';
+ $sql .= ', f.fk_projet as fk_project, f.fk_account';
$sql .= ', f.fk_mode_reglement, p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= ', f.fk_cond_reglement, c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
$sql .= ', f.date_lim_reglement';
@@ -610,7 +610,7 @@ class FactureFournisseurRec extends CommonInvoice
$this->total_ttc = $obj->total_ttc;
$this->user_author = $obj->fk_user_author;
$this->user_modif = $obj->fk_user_modif;
- $this->fk_project = $obj->fk_projet;
+ $this->fk_project = $obj->fk_project;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 48c5e88c2c5..df10ed07632 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -443,7 +443,8 @@ class FactureFournisseur extends CommonInvoice
$this->entity = $_facrec->entity; // Invoice created in same entity than template
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
- $this->fk_projet = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_projet;
+ $this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_projet;
+ $this->fk_projet = $this->fk_project;
$this->note_public = GETPOST('note_public', 'restricthtml') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
$this->note_private = GETPOST('note_private', 'restricthtml') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
$this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index a7d03c901c9..c2fc4e8511a 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -8,10 +8,10 @@
* Copyright (C) 2013-2015 Philippe Grand
* Copyright (C) 2013 Florian Henry
* Copyright (C) 2014-2016 Marcos García
- * Copyright (C) 2016-2021 Alexandre Spangaro
+ * Copyright (C) 2016-2022 Alexandre Spangaro
* Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2019 Ferran Marcet
- * Copyright (C) 2022 Gauthier VERDOL
+ * Copyright (C) 2022 Gauthier VERDOL
*
* 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
@@ -3169,23 +3169,28 @@ if ($action == 'create') {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print ''.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print ' ';
// Multicurrency Amount VAT
print ''.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print ' ';
// Multicurrency Amount TTC
print ''.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).' ';
- print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
+ print ''.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' ';
print ' ';
}
// Amount
- print ''.$langs->trans('AmountHT').' '.price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).' ';
- print ''.$langs->trans('AmountVAT').' '.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency);
+ print ' '.$langs->trans('AmountHT').' ';
+ print ''.price($object->total_ht, 1, $langs, 0, -1, -1, $conf->currency).' ';
+ print ' ';
+
+ // VAT
+ print ''.$langs->trans('AmountVAT').' ';
+ print '';
if (GETPOST('calculationrule')) {
$calculationrule = GETPOST('calculationrule', 'alpha');
} else {
@@ -3203,25 +3208,28 @@ if ($action == 'create') {
$s .= ' / ';
$s .= 'id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").' ';
print '';
- print ' ';
print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).' '.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
+ print ' ';
print '
';
}
+ print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency);
print ' ';
// Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj == "1") { //Localtax1
print ''.$langs->transcountry("AmountLT1", $societe->country_code).' ';
- print ''.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).' ';
+ print ''.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).' ';
print ' ';
}
if ($societe->localtax2_assuj == "1") { //Localtax2
print ''.$langs->transcountry("AmountLT2", $societe->country_code).' ';
- print ''.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).' ';
+ print ''.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).' ';
print ' ';
}
- print ''.$langs->trans('AmountTTC').' '.price($object->total_ttc, 1, $langs, 0, -1, -1, $conf->currency).' ';
+ print ''.$langs->trans('AmountTTC').' ';
+ print ''.price($object->total_ttc, 1, $langs, 0, -1, -1, $conf->currency).' ';
+ print ' ';
print '
';
diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php
index ececc70b4f1..ddf5fe989f2 100644
--- a/htdocs/hrm/class/skill.class.php
+++ b/htdocs/hrm/class/skill.class.php
@@ -119,7 +119,7 @@ class Skill extends CommonObject
'required_level' => array('type'=>'integer', 'label'=>'requiredLevel', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>0,),
'date_validite' => array('type'=>'integer', 'label'=>'date_validite', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>0,),
'temps_theorique' => array('type'=>'double(24,8)', 'label'=>'temps_theorique', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>0,),
- 'skill_type' => array('type'=>'integer', 'label'=>'SkillType', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'knowHow', '1'=>'HowToBe', '9'=>'knowledge'), 'default'=>0),
+ 'skill_type' => array('type'=>'integer', 'label'=>'SkillType', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'css'=>'minwidth200', 'arrayofkeyval'=>array('0'=>'TypeKnowHow', '1'=>'TypeHowToBe', '9'=>'TypeKnowledge'), 'default'=>0),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>0,),
);
@@ -1123,9 +1123,9 @@ class Skill extends CommonObject
global $langs;
$result = '';
switch ($code) {
- case 0 : $result = $langs->trans("knowHow"); break; //"Savoir Faire"
- case 1 : $result = $langs->trans("HowToBe"); break; // "Savoir être"
- case 9 : $result = $langs->trans("knowledge"); break; //"Savoir"
+ case 0 : $result = $langs->trans("TypeKnowHow"); break; //"Savoir Faire"
+ case 1 : $result = $langs->trans("TypeHowToBe"); break; // "Savoir être"
+ case 9 : $result = $langs->trans("TypeKnowledge"); break; //"Savoir"
}
return $result;
}
diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php
index 466741153c4..cc584b2e8d4 100644
--- a/htdocs/hrm/evaluation_list.php
+++ b/htdocs/hrm/evaluation_list.php
@@ -208,7 +208,7 @@ $now = dol_now();
//$help_url="EN:Module_Evaluation|FR:Module_Evaluation_FR|ES:Módulo_Evaluation";
$help_url = '';
-$title = $langs->trans("List").' '.$langs->trans('Evaluations');
+$title = $langs->trans('Evaluations');
$morejs = array();
$morecss = array();
diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php
index 29493aa9cbd..a9ec4f77121 100644
--- a/htdocs/hrm/job_card.php
+++ b/htdocs/hrm/job_card.php
@@ -21,8 +21,8 @@
/**
* \file job_card.php
- * \ingroup hrm
- * \brief Page to create/edit/view job
+ * \ingroup hrm
+ * \brief Page to create/edit/view job
*/
diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php
index 33f4ea46305..53cb43ad080 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -208,7 +208,7 @@ $now = dol_now();
//$help_url="EN:Module_Job|FR:Module_Job_FR|ES:Módulo_Job";
$help_url = '';
-$title = $langs->trans("ListOf", $langs->transnoentities('Jobs'));
+$title = $langs->trans("JobsPosition");
$morejs = array();
$morecss = array();
diff --git a/htdocs/hrm/lib/hrm_job.lib.php b/htdocs/hrm/lib/hrm_job.lib.php
index 723aaf14af5..6a948b00439 100644
--- a/htdocs/hrm/lib/hrm_job.lib.php
+++ b/htdocs/hrm/lib/hrm_job.lib.php
@@ -40,7 +40,7 @@ function jobPrepareHead($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT."/hrm/job_card.php?id=".$object->id;
- $head[$h][1] = $langs->trans("JobCard");
+ $head[$h][1] = $langs->trans("JobPosition");
$head[$h][2] = 'job_card';
$h++;
diff --git a/htdocs/hrm/lib/hrm_position.lib.php b/htdocs/hrm/lib/hrm_position.lib.php
index da9a7b3123a..37eaa3c5684 100644
--- a/htdocs/hrm/lib/hrm_position.lib.php
+++ b/htdocs/hrm/lib/hrm_position.lib.php
@@ -31,7 +31,7 @@
* @param Position $object Position
* @return array Array of tabs
*/
-function PositionCardPrepareHead($object)
+function positionCardPrepareHead($object)
{
global $db, $langs, $conf;
@@ -41,7 +41,7 @@ function PositionCardPrepareHead($object)
$head = array();
$head[$h][0] = dol_buildpath("/hrm/position_card.php", 1).'?id='.$object->id;
- $head[$h][1] = $langs->trans("PositionCard");
+ $head[$h][1] = $langs->trans("EmployeePosition");
$head[$h][2] = 'position';
$h++;
diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php
index 24f2d9e32ef..ccbfabb985b 100644
--- a/htdocs/hrm/position_agenda.php
+++ b/htdocs/hrm/position_agenda.php
@@ -141,7 +141,7 @@ if ($object->id > 0) {
if (!empty($conf->notification->enabled)) {
$langs->load("mails");
}
- $head = PositionCardPrepareHead($object);
+ $head = positionCardPrepareHead($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Agenda"), -1, $object->picto);
diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php
index 6e751a9005a..746e1265a0b 100644
--- a/htdocs/hrm/position_card.php
+++ b/htdocs/hrm/position_card.php
@@ -171,18 +171,18 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
}
-DisplayPositionCard($object);
+
+displayPositionCard($object);
+
/**
* Show the card of a position
*
* @param Position $object Position object
- *
* @return void
*/
-function DisplayPositionCard(&$object)
+function displayPositionCard(&$object)
{
-
global $user, $langs, $db, $conf, $extrafields, $hookmanager, $action, $permissiontoadd, $permissiontodelete;
$id = $object->id;
@@ -245,7 +245,7 @@ function DisplayPositionCard(&$object)
$res = $object->fetch_optionals();
- $head = PositionCardPrepareHead($object);
+ $head = positionCardPrepareHead($object);
print dol_get_fiche_head($head, 'position', $langs->trans("Workstation"), -1, $object->picto);
$formconfirm = '';
diff --git a/htdocs/hrm/position_contact.php b/htdocs/hrm/position_contact.php
index d26ea1bf575..56029f790a7 100644
--- a/htdocs/hrm/position_contact.php
+++ b/htdocs/hrm/position_contact.php
@@ -125,7 +125,7 @@ if ($object->id) {
/*
* Show tabs
*/
- $head = PositionCardPrepareHead($object);
+ $head = positionCardPrepareHead($object);
print dol_get_fiche_head($head, 'contact', '', -1, $object->picto);
diff --git a/htdocs/hrm/position_document.php b/htdocs/hrm/position_document.php
index 845f846a212..eb4ac0e68ce 100644
--- a/htdocs/hrm/position_document.php
+++ b/htdocs/hrm/position_document.php
@@ -113,7 +113,7 @@ if ($object->id) {
/*
* Show tabs
*/
- $head = PositionCardPrepareHead($object);
+ $head = positionCardPrepareHead($object);
print dol_get_fiche_head($head, 'document', $langs->trans("Document"), -1, $object->picto);
diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php
index f193783cb42..e9eb83e12e4 100644
--- a/htdocs/hrm/position_list.php
+++ b/htdocs/hrm/position_list.php
@@ -208,7 +208,7 @@ $now = dol_now();
//$help_url="EN:Module_Position|FR:Module_Position_FR|ES:Módulo_Position";
$help_url = '';
-$title = $langs->trans("ListOf", $langs->trans('Positions'));
+$title = $langs->trans('EmployeePositions');
$morejs = array();
$morecss = array();
diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php
index 1eea4b82676..99d6581247f 100644
--- a/htdocs/hrm/position_note.php
+++ b/htdocs/hrm/position_note.php
@@ -96,7 +96,7 @@ llxHeader('', $langs->trans('Position'), $help_url);
if ($id > 0 || !empty($ref)) {
$object->fetch_thirdparty();
- $head = PositionCardPrepareHead($object);
+ $head = positionCardPrepareHead($object);
print dol_get_fiche_head($head, 'note', $langs->trans("Notes"), -1, $object->picto);
diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php
index 9c5a4740c15..65a3cac0ecf 100644
--- a/htdocs/hrm/skill_list.php
+++ b/htdocs/hrm/skill_list.php
@@ -208,7 +208,7 @@ $now = dol_now();
//$help_url="EN:Module_Skill|FR:Module_Skill_FR|ES:Módulo_Skill";
$help_url = '';
-$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Skills"));
+$title = $langs->trans("Skills");
$morejs = array();
$morecss = array();
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index c625b97e6a6..52784558b45 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -462,7 +462,6 @@ if ($step == 2 && $datatoimport) {
print '
';
}
print '
';
@@ -2887,7 +2913,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Capital
print ''.$langs->trans('Capital').' ';
if ($object->capital) {
- print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
+ if (!empty($conf->multicurrency->enabled) && !empty($object->multicurrency_code)) {
+ print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code);
+ } else {
+ print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
+ }
} else {
print ' ';
}
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 5eda12f56de..2f82eefffeb 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -22,6 +22,7 @@
--colorbacklinebreak: rgb();
--colorbackbody: rgb();
--colorbackmobilemenu: #f8f8f8;
+ --colorbackgrey: #f0f0f0;
--colortexttitlenotab: rgb();
--colortexttitlenotab2: rgb();
--colortexttitle: rgba(, 0.9);
@@ -72,6 +73,7 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
--colorbacklinepairchecked: #0e5ccd;
--colorbackbody: #1d1e20;
--colorbackmobilemenu: #080808;
+ --colorbackgrey: #0f0f0f;
--tooltipbgcolor: #2b2d2f;
--colortexttitlenotab: rgb(220,220,220);
--colortexttitlenotab2: rgb(220,220,220);
@@ -273,8 +275,7 @@ input:invalid, select:invalid, input.--error , select.--error {
section.setupsection {
padding: 20px;
- /* background-color: var(--colorbacktitle1); */
- background-color: #f0f0f0;
+ background-color: var(--colorbackgrey);
border-radius: 5px;
}
@@ -1044,6 +1045,7 @@ div.divsearchfield {
overflow: auto;
padding-bottom: 5px;
opacity: 0.6;
+ font-size: small;
}
.divadvancedsearchfield:first-child {
margin-top: 3px;
@@ -4816,7 +4818,7 @@ div#card-errors {
color: #fa755a;
text-align: center;
padding-top: 3px;
- max-width: 320px;
+ /* max-width: 320px; */
}
@@ -7614,6 +7616,14 @@ div.clipboardCPValue.hidewithsize {
/* border-bottom: 2px solid var(--colorbackhmenu1) !important; */
border-bottom: 1px solid var(--colortopbordertitle1) !important;
}
+
+ div#card-errors {
+ max-width: unset;
+ }
+
+ #dolpaymenttable {
+ padding: 5px;
+ }
}
@media only screen and (max-width: 320px)
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 3c05847a79c..bcd2598740a 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -530,6 +530,7 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment {
background-color: #eee;
white-space: normal;
color: #888 !important;
+ height: 60px;
}
.nofocusvisible:focus-visible {
outline: none;
@@ -1163,6 +1164,7 @@ div.divsearchfield {
white-space: nowrap;
padding-bottom: 5px;
opacity: 0.6;
+ font-size: small;
}
.divadvancedsearchfield:first-child {
margin-top: 3px;
@@ -4669,11 +4671,10 @@ div#card-errors {
color: #fa755a;
text-align: center;
padding-top: 3px;
- max-width: 320px;
+ /* max-width: 320px; */
}
-
/*
* Effect Postit
*/
@@ -6118,6 +6119,17 @@ ul.select2-results__options li {
font-size: 0.95em;
}
+@media only screen and (min-width: 767px)
+{
+ .select2-container.select2-container--open .select2-dropdown.ui-dialog {
+ min-width: 200px !important;
+ }
+ .select2-container--open .select2-dropdown--below {
+ border-top: 1px solid var(--inputbordercolor);
+ /* border-top: 1px solid #aaaaaa; */
+ }
+}
+
/* ============================================================================== */
/* For categories */
@@ -7288,6 +7300,14 @@ div.clipboardCPValue.hidewithsize {
div.divButAction {
margin-bottom: 0.5em;
}
+
+ div#card-errors {
+ max-width: unset;
+ }
+
+ #dolpaymenttable {
+ padding: 5px;
+ }
}
diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php
index 5de60a48d85..558faf1775a 100644
--- a/htdocs/ticket/class/cticketcategory.class.php
+++ b/htdocs/ticket/class/cticketcategory.class.php
@@ -274,9 +274,6 @@ class CTicketCategory extends CommonObject
if (property_exists($object, 'label')) {
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
}
- if (property_exists($object, 'status')) {
- $object->status = self::STATUS_DRAFT;
- }
if (property_exists($object, 'date_creation')) {
$object->date_creation = dol_now();
}
@@ -488,155 +485,6 @@ class CTicketCategory extends CommonObject
}
- /**
- * Validate object
- *
- * @param User $user User making status change
- * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
- * @return int <=0 if OK, 0=Nothing done, >0 if KO
- */
- public function validate($user, $notrigger = 0)
- {
- global $conf, $langs;
-
- require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
-
- $error = 0;
-
- // Protection
- if ($this->status == self::STATUS_VALIDATED) {
- dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
- return 0;
- }
-
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->write))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->myobject->myobject_advance->validate))))
- {
- $this->error='NotEnoughPermissions';
- dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
- return -1;
- }*/
-
- $now = dol_now();
-
- $this->db->begin();
-
- // Define new ref
- if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
- $num = $this->getNextNumRef();
- } else {
- $num = $this->ref;
- }
- $this->newref = $num;
-
- if (!empty($num)) {
- // Validate
- $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
- $sql .= " SET ref = '".$this->db->escape($num)."',";
- $sql .= " status = ".self::STATUS_VALIDATED;
- if (!empty($this->fields['date_validation'])) {
- $sql .= ", date_validation = '".$this->db->idate($now)."'";
- }
- if (!empty($this->fields['fk_user_valid'])) {
- $sql .= ", fk_user_valid = ".((int) $user->id);
- }
- $sql .= " WHERE rowid = ".((int) $this->id);
-
- dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (!$resql) {
- dol_print_error($this->db);
- $this->error = $this->db->lasterror();
- $error++;
- }
-
- if (!$error && !$notrigger) {
- // Call trigger
- $result = $this->call_trigger('CTICKETCATEGORY_VALIDATE', $user);
- if ($result < 0) {
- $error++;
- }
- // End call triggers
- }
- }
-
- if (!$error) {
- $this->oldref = $this->ref;
-
- // Rename directory if dir was a temporary ref
- if (preg_match('/^[\(]?PROV/i', $this->ref)) {
- // Now we rename also files into index
- $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'myobject/".$this->db->escape($this->newref)."'";
- $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'myobject/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
- $resql = $this->db->query($sql);
- if (!$resql) {
- $error++; $this->error = $this->db->lasterror();
- }
-
- // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
- $oldref = dol_sanitizeFileName($this->ref);
- $newref = dol_sanitizeFileName($num);
- $dirsource = $conf->mymodule->dir_output.'/myobject/'.$oldref;
- $dirdest = $conf->mymodule->dir_output.'/myobject/'.$newref;
- if (!$error && file_exists($dirsource)) {
- dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
-
- if (@rename($dirsource, $dirdest)) {
- dol_syslog("Rename ok");
- // Rename docs starting with $oldref with $newref
- $listoffiles = dol_dir_list($conf->mymodule->dir_output.'/myobject/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
- foreach ($listoffiles as $fileentry) {
- $dirsource = $fileentry['name'];
- $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
- $dirsource = $fileentry['path'].'/'.$dirsource;
- $dirdest = $fileentry['path'].'/'.$dirdest;
- @rename($dirsource, $dirdest);
- }
- }
- }
- }
- }
-
- // Set new ref and current status
- if (!$error) {
- $this->ref = $num;
- $this->status = self::STATUS_VALIDATED;
- }
-
- if (!$error) {
- $this->db->commit();
- return 1;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
-
-
- /**
- * Set cancel status
- *
- * @param User $user Object user that modify
- * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
- * @return int <0 if KO, 0=Nothing done, >0 if OK
- */
- public function cancel($user, $notrigger = 0)
- {
- // Protection
- if ($this->status != self::STATUS_VALIDATED) {
- return 0;
- }
-
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
- {
- $this->error='Permission denied';
- return -1;
- }*/
-
- return $this->setStatusCommon($user, self::STATUS_DISABLED, $notrigger, 'CTICKETCATEGORY_CANCEL');
- }
-
/**
* Return a link to the object card (with optionaly the picto)
*
diff --git a/htdocs/ticket/class/ticketstats.class.php b/htdocs/ticket/class/ticketstats.class.php
index 2af0b789c3d..41fc4b0f69a 100644
--- a/htdocs/ticket/class/ticketstats.class.php
+++ b/htdocs/ticket/class/ticketstats.class.php
@@ -89,12 +89,13 @@ class TicketStats extends Stats
}
/**
- * Renvoie le nombre de facture par mois pour une annee donnee
+ * Return the number of tickets per month for a given year
*
- * @param string $year Year to scan
- * @return array Array of values
+ * @param string $year Year to scan
+ * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
+ * @return array Array of values
*/
- public function getNbByMonth($year)
+ public function getNbByMonth($year, $format = 0)
{
$sql = "SELECT MONTH(datec) as dm, count(*)";
$sql .= " FROM ".$this->from;
@@ -103,18 +104,19 @@ class TicketStats extends Stats
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
- $res = $this->_getNbByMonth($year, $sql);
+ $res = $this->_getNbByMonth($year, $sql, $format);
//var_dump($res);print ' ';
return $res;
}
/**
- * Renvoie le montant de facture par mois pour une annee donnee
+ * Return th eamount of tickets for a month and a given year
*
- * @param int $year Year to scan
- * @return array Array of values
+ * @param int $year Year to scan
+ * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
+ * @return array Array of values
*/
- public function getAmountByMonth($year)
+ public function getAmountByMonth($year, $format = 0)
{
$sql = "SELECT date_format(datec,'%m') as dm, sum(".$this->field.")";
$sql .= " FROM ".$this->from;
@@ -123,7 +125,7 @@ class TicketStats extends Stats
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
- $res = $this->_getAmountByMonth($year, $sql);
+ $res = $this->_getAmountByMonth($year, $sql, $format);
//var_dump($res);print ' ';
return $res;
}
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 0a58c0bcf44..0b1cd8e3878 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -3412,6 +3412,11 @@ if ($action == 'editcss') {
print ' ';
print $form->textwithpicto($langs->trans('ImportFavicon'), $langs->trans('FaviconTooltip'));
print ' ';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ $texte .= ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
print ' ';
print ' ';
@@ -3633,7 +3638,11 @@ if ($action == 'importsite') {
print ''.$langs->trans("ZipOfWebsitePackageToImport").' ';
- print ' ';
+ $maxfilesizearray = getMaxFileSizeArray();
+ $maxmin = $maxfilesizearray['maxmin'];
+ if ($maxmin > 0) {
+ print ' '; // MAX_FILE_SIZE must precede the field type=file
+ }
print ' ';
print ' ';
print ' ';
diff --git a/test/phpunit/EvalMathTest.php b/test/phpunit/EvalMathTest.php
new file mode 100644
index 00000000000..1346538668c
--- /dev/null
+++ b/test/phpunit/EvalMathTest.php
@@ -0,0 +1,151 @@
+
+ * Copyright (C) 2022 Quatadah Nasdami
+ *
+ * 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 .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file test/phpunit/InventoryTest.php
+ * \ingroup test
+ * \brief PHPUnit test
+ * \remarks To run this script as CLI: phpunit filename.php
+ */
+
+global $conf,$user,$langs,$db;
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/core/class/evalmath.class.php';
+
+if (empty($user->id)) {
+ print "Load permissions for admin user nb 1\n";
+ $user->fetch(1);
+ $user->getrights();
+}
+$conf->global->MAIN_DISABLE_ALL_MAILS=1;
+
+
+/**
+ * Class for PHPUnit tests
+ *
+ * @backupGlobals disabled
+ * @backupStaticAttributes enabled
+ * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
+ */
+class InventoryTest extends PHPUnit\Framework\TestCase
+{
+ protected $savconf;
+ protected $savuser;
+ protected $savlangs;
+ protected $savdb;
+
+ /**
+ * Constructor
+ * We save global variables into local variables
+ *
+ * @return InventoryTest
+ */
+ public function __construct()
+ {
+ parent::__construct();
+
+ //$this->sharedFixture
+ global $conf,$user,$langs,$db;
+ $this->savconf=$conf;
+ $this->savuser=$user;
+ $this->savlangs=$langs;
+ $this->savdb=$db;
+
+ print __METHOD__." db->type=".$db->type." user->id=".$user->id;
+ //print " - db ".$db->db;
+ print "\n";
+ }
+
+ /**
+ * setUpBeforeClass
+ *
+ * @return void
+ */
+ public static function setUpBeforeClass()
+ {
+ global $conf,$user,$langs,$db;
+
+ $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
+
+ print __METHOD__."\n";
+ }
+
+ /**
+ * tearDownAfterClass
+ *
+ * @return void
+ */
+ public static function tearDownAfterClass()
+ {
+ global $conf,$user,$langs,$db;
+ $db->rollback();
+
+ print __METHOD__."\n";
+ }
+
+ /**
+ * Init phpunit tests
+ *
+ * @return void
+ */
+ protected function setUp()
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ print __METHOD__."\n";
+ }
+
+ /**
+ * End phpunit tests
+ *
+ * @return void
+ */
+ protected function tearDown()
+ {
+ print __METHOD__."\n";
+ }
+
+ /**
+ * test postfix evaluation function
+ * @return void
+ */
+ public function testEvaluate()
+ {
+ $localobject = new EvalMath();
+ $result = $localobject->evaluate('1+1');
+ $this->assertEquals($result, 2);
+ print __METHOD__." result=".$result."\n";
+
+ $result = $localobject->evaluate('10-4/4');
+ $this->assertEquals($result, 9);
+ print __METHOD__." result=".$result."\n";
+
+ $result = $localobject->evaluate('3^3');
+ $this->assertEquals($result, 27);
+ print __METHOD__." result=".$result."\n";
+
+ $result = $localobject->evaluate('');
+ $this->assertEquals($result, '');
+ print __METHOD__." result=".$result."\n";
+ }
+}