diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php
index 384b08e19cf..4bae5f4862d 100644
--- a/htdocs/admin/tools/export_files.php
+++ b/htdocs/admin/tools/export_files.php
@@ -126,8 +126,10 @@ $utils = new Utils($db);
if ($compression == 'zip') {
$file .= '.zip';
- $excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
+
+ $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i';
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, $excludefiles);
+
if ($ret < 0) {
if ($ret == -2) {
$langs->load("errors");
diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index 0a84de7b7c1..e4f093be87f 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -348,6 +348,9 @@ class DolibarrApi
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
+ if ($operator == 'NOTLIKE') {
+ $operator = 'NOT LIKE';
+ }
$tmpescaped = trim($tmp[2]);
$regbis = array();
diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php
index d24ba63ef55..f8daff1cd14 100644
--- a/htdocs/bookmarks/bookmarks.lib.php
+++ b/htdocs/bookmarks/bookmarks.lib.php
@@ -66,7 +66,7 @@ function printDropdownBookmarksList()
// Url to list bookmark
- $listbtn = '';
// Url to go on create new bookmark page
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index c96f24760c0..63f2977acdb 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1944,7 +1944,7 @@ if ($action == 'create') {
// We verify whether the object is provisionally numbering
$ref = substr($object->ref, 1, 4);
- if ($ref == 'PROV') {
+ if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc);
if (empty($numref)) {
$error++;
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index ba96725ddbd..3ed5ede556c 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1877,8 +1877,12 @@ if ($action == 'create' && $usercancreate) {
if ($action == 'validate') {
// We check that object has a temporary ref
$ref = substr($object->ref, 1, 4);
- if ($ref == 'PROV') {
+ if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc);
+ if (empty($numref)) {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
} else {
$numref = $object->ref;
}
@@ -1915,7 +1919,9 @@ if ($action == 'create' && $usercancreate) {
);
}
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
+ if (!$error) {
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
+ }
}
// Confirm back to draft status
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index b15599cc931..a41de0ce755 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -765,8 +765,8 @@ if (empty($reshook)) {
// Define special_code for special lines
$special_code = GETPOST('special_code', 'int');
- if (!GETPOST('qty', 'alpha')) {
- $special_code = 3;
+ if ($special_code == 3) {
+ $special_code = 0; // Options should not exists on invoices
}
/*$line = new FactureLigne($db);
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 4230a22daaf..3203332b137 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2371,9 +2371,9 @@ if (empty($reshook)) {
}
// Define special_code for special lines
- $special_code = GETPOST('special_code');
- if (!GETPOST('qty')) {
- $special_code = 3;
+ $special_code = GETPOST('special_code', 'int');
+ if ($special_code == 3) {
+ $special_code = 0; // Options should not exists on invoices
}
$line = new FactureLigne($db);
@@ -2898,6 +2898,9 @@ if ($action == 'create') {
if (empty($mode_reglement_id)) {
$mode_reglement_id = $soc->mode_reglement_id;
}
+ if (empty($fk_account)) {
+ $fk_account = $soc->fk_account;
+ }
if (!$remise_percent) {
$remise_percent = $soc->remise_percent;
}
@@ -3005,6 +3008,9 @@ if ($action == 'create') {
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
}
+ // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
+ $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
+
if (!empty($soc->id)) {
$absolute_discount = $soc->getAvailableDiscounts();
}
@@ -3607,8 +3613,8 @@ if ($action == 'create') {
// Bank Account
if (!empty($conf->banque->enabled)) {
print '
| '.$langs->trans('BankAccount').' | ';
- $fk_account = GETPOST('fk_account', 'int');
- print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
+ print img_picto('', 'bank_account', 'class="pictofixedwidth"');
+ print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print ' |
';
}
diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php
index 323221f6f2b..d52a8c3941d 100644
--- a/htdocs/compta/paiement_vat.php
+++ b/htdocs/compta/paiement_vat.php
@@ -83,7 +83,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
}
}
- if ($amounts[key($amounts)] <= 0) {
+ if (empty($amounts[key($amounts)])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index b5aca49aaae..8f71015517c 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -857,32 +857,29 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
if ($modecompta == 'CREANCES-DETTES') {
- $column = 'p.datev';
+ $column = 's.dateep'; // We use the date of end of period of salary
+
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
+ $sql .= " WHERE s.entity IN (".getEntity('salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm";
} else {
$column = 'p.datep';
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
+ $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
}
- $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
- $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
- }
- $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
-
- // For backward compatibility with old module salary
- $sql .= " UNION ";
- $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
- $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
- }
- $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
-
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') {
$newsortfield = 'u.firstname, u.lastname';
@@ -896,7 +893,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql .= $db->order($newsortfield, $sortorder);
}
- dol_syslog("get payment salaries");
+ dol_syslog("get salaries");
$result = $db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 2d4ea6fc9e0..2d3ba90cd7d 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -611,21 +611,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
if ($modecompta == 'CREANCES-DETTES') {
- $column = 'p.datev';
+ $column = 's.dateep'; // we use the date of end of period of salary
+
+ $sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
+ $sql .= " WHERE s.entity IN (".getEntity('salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY s.label, dm";
}
if ($modecompta == "RECETTES-DEPENSES") {
$column = 'p.datep';
+
+ $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid";
+ $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
+ }
+ $sql .= " GROUP BY p.label, dm";
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
- $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
- $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
- if (!empty($date_start) && !empty($date_end)) {
- $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
- }
- $sql .= " GROUP BY p.label, dm";
dol_syslog("get social salaries payments");
$result = $db->query($sql);
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 1755378f7d4..2db79ac39e8 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1355,7 +1355,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$note = $prodser->multilangs[$outputlangs->defaultlang]["other"];
}
}
- } elseif ($object->element == 'facture' || $object->element == 'facturefourn') {
+ } elseif (($object->element == 'facture' || $object->element == 'facturefourn') && preg_match('/^\(DEPOSIT\).+/', $desc)) { // We must not replace '(DEPOSIT)' when it is alone, it will be translated and detailed later
$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
}
diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php
index f7c9fc201f4..36eeee89627 100644
--- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php
+++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php
@@ -18,15 +18,14 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
if (empty($extrafieldsobjectprefix)) {
$extrafieldsobjectprefix = 'ef.';
}
-
foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$extrafieldsobjectkey]['list'][$key])) {
$arrayfields[$extrafieldsobjectprefix.$key] = array(
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
- 'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1),
+ 'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1) <= 0) ? 0 : 1),
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
- 'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]),
+ 'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1)),
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
);
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 743930767dd..4bec4220c6c 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1194,6 +1194,7 @@ if ($action == 'create') {
print '';
} else {
if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
+ print '';
print '';
}
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 64f0e00d6f8..eb0a5999f29 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -370,13 +370,15 @@ class Expedition extends CommonObject
// Insert of lines
$num = count($this->lines);
for ($i = 0; $i < $num; $i++) {
- if (!isset($this->lines[$i]->detail_batch)) { // no batch management
- if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
- $error++;
- }
- } else { // with batch management
- if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
- $error++;
+ if (empty($this->lines[$i]->product_type) || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
+ if (!isset($this->lines[$i]->detail_batch)) { // no batch management
+ if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) {
+ $error++;
+ }
+ } else { // with batch management
+ if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0) {
+ $error++;
+ }
}
}
}
@@ -916,6 +918,7 @@ class Expedition extends CommonObject
// Copy the rang of the order line to the expedition line
$line->rang = $orderline->rang;
+ $line->product_type = $orderline->product_type;
if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) {
$fk_product = $orderline->fk_product;
@@ -968,6 +971,8 @@ class Expedition extends CommonObject
}
$this->lines[$num] = $line;
+
+ return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -2602,6 +2607,12 @@ class ExpeditionLigne extends CommonObjectLine
*/
public $product_desc;
+ /**
+ * Type of the product. 0 for product, 1 for service
+ * @var int
+ */
+ public $product_type = 0;
+
/**
* @var int rang of line
*/
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 614130097c5..528bda30442 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -470,15 +470,15 @@ class CommandeFournisseur extends CommonOrder
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND l.qty >= pfp.quantity AND pfp.fk_soc = ".((int) $this->socid);
}
$sql .= " WHERE l.fk_commande = ".$this->id;
if ($only_product) {
$sql .= ' AND p.fk_product_type = 0';
}
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
- $sql.= " AND l.qty >= pfp.quantity ";
- $sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) ";
+ $sql.= " GROUP BY l.rowid";
+ $sql.= " HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
}
$sql .= " ORDER BY l.rang, l.rowid";
//print $sql;
@@ -3528,11 +3528,11 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn AND cd.qty >= pfp.quantity";
}
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
- $sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)";
+ $sql .= " GROUP BY cd.rowid HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)";
}
$result = $this->db->query($sql);
if ($result) {
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 70d9c8da54d..bbabc5327d8 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -113,7 +113,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write &&
if ($user->socid) {
$socid = $user->socid;
}
-$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
+$result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut);
/*
@@ -1400,7 +1400,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
// Confirmation messages
if ($action == 'delete') {
- if ($user->rights->holiday->delete) {
+ if ($candelete) {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1);
}
}
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index fa8cb0197cc..b9a5e535d21 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -43,6 +43,8 @@ create table llx_commande_fournisseur_dispatch_extrafields
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
+ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1;
+
UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
create table llx_c_shipment_package_type
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index a9f1a669e52..4ba3eae2554 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -566,7 +566,8 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
-ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
+ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
+ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index d03d6b1f75c..e8a3880ff40 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -84,6 +84,9 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'a
UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo';
DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo');
+ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
+ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
+
-- For v14
diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
index 4e1d75dd1dd..2e9c88bd5ca 100644
--- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
+++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql
@@ -50,8 +50,7 @@ create table llx_product_fournisseur_price
import_key varchar(14), -- Import key
delivery_time_days integer,
supplier_reputation varchar(10),
- packaging varchar(64),
-
+ packaging varchar(64) DEFAULT NULL,
fk_multicurrency integer,
multicurrency_code varchar(255),
multicurrency_tx double(24,8) DEFAULT 1,
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index d4abe482a88..97ac9adb6a3 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -112,8 +112,8 @@ class Mo extends CommonObject
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
- 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
- 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
+ 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
+ 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index fa75a20277f..ab54e292215 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -148,25 +148,8 @@ if ($action == 'other') {
$value = GETPOST('activate_FillProductDescAuto', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity);
- if ($value) {
- $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
- $resql = $db->query($sql_test);
- if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
- $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text";
- $resql_new = $db->query($sql_new);
- }
- }
-
$value = GETPOST('activate_useProdSupplierPackaging', 'alpha');
$res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity);
- if ($value) {
- $sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
- $resql = $db->query($sql_test);
- if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') { // if the field does not exist, we create it
- $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1";
- $resql_new = $db->query($sql_new);
- }
- }
}
if ($action == 'specimen') { // For products
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 9b36c67643d..f72642c249a 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1947,7 +1947,10 @@ class Product extends CommonObject
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
$sql .= " pfp.packaging";
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
- $sql .= " WHERE pfp.fk_product = ".((int) $product_id);
+ $sql .= " WHERE 1 = 1";
+ if ($product_id > 0) {
+ $sql .= " AND pfp.fk_product = ".((int) $product_id);
+ }
if ($fourn_ref != 'none') {
$sql .= " AND pfp.ref_fourn = '".$this->db->escape($fourn_ref)."'";
}
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 8f07d1bede7..9f98202099a 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -491,6 +491,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
$sql .= " AND e.fk_soc = sc.fk_soc";
@@ -976,6 +979,9 @@ while ($i < min($num, $limit)) {
{
}*/
print "\n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
@@ -1071,6 +1077,13 @@ if ($num == 0) {
print '| '.$langs->trans("NoRecordFound").' |
';
}
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
print "";
print "";
print '';
diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php
index 627a6c99565..b834ff64d0a 100644
--- a/htdocs/takepos/receipt.php
+++ b/htdocs/takepos/receipt.php
@@ -48,7 +48,7 @@ if (!isset($action)) {
}
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-$langs->loadLangs(array("main", "cashdesk", "companies"));
+$langs->loadLangs(array("main", "bills", "cashdesk", "companies"));
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
@@ -68,7 +68,7 @@ if (empty($user->rights->takepos->run)) {
top_httphead('text/html');
if ($place > 0) {
- $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'";
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if ($obj) {
@@ -79,6 +79,7 @@ $object = new Facture($db);
$object->fetch($facid);
// Call to external receipt modules if exist
+$parameters = array();
$hookmanager->initHooks(array('takeposfrontend'), $facid);
$reshook = $hookmanager->executeHooks('TakeposReceipt', $parameters, $object);
if (!empty($hookmanager->resPrint)) {
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 0e91bd5bc9f..881f741650d 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -234,7 +234,7 @@ if (empty($modulepart)) {
accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
}
-$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
+$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name