diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 555dcd665db..4bb74087c19 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -69,10 +69,19 @@ foreach ($dirsyslogs as $reldir) { if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); - require_once $newdir.$file.'.php'; + try { + require_once $newdir.$file.'.php'; - $module = new $file(); - '@phan-var-force LogHandler $module'; + if (!class_exists($file)) { + dol_syslog('admin/syslog.php skipping stale handler '.$file.' (class not declared)', LOG_WARNING); + continue; + } + $module = new $file(); + '@phan-var-force LogHandler $module'; + } catch (Throwable $e) { + dol_syslog('admin/syslog.php skipping stale handler '.$file.': '.$e->getMessage(), LOG_WARNING); + continue; + } // Show modules according to features level if ($module->getVersion() == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 556bc40d34a..a0f7500555a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -682,6 +682,13 @@ class Categorie extends CommonObject $this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0); $this->visible = ($this->visible != "" ? intval($this->visible) : 0); + if ($this->fk_parent > 0 && $this->fk_parent == $this->id) { + $langs->load('categories'); + $this->error = $langs->trans("ErrorCategoryCannotBeItsOwnParent"); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + if ($this->already_exists()) { $this->error = $langs->trans("ImpossibleUpdateCat"); $this->error .= " : ".$langs->trans("CategoryExistsAtSameLevel"); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 65875653d2c..cfe601075d4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1537,7 +1537,7 @@ class ActionComm extends CommonObject if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 663a65b60c2..ff899f01e3c 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -157,7 +157,7 @@ class AgendaEvents extends DolibarrApi if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (t.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } // Add sql filters diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 01a679f7bb9..a2b1a4aef90 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -864,7 +864,7 @@ if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } // Search on socid diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dd36aa23349..112b91ff548 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -547,7 +547,7 @@ if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } // Search on socid diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index e45f5cf7382..bc41f0d4281 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -613,7 +613,7 @@ if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } // Search on socid diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 30f999e7d20..a1342bc7b1f 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -784,7 +784,7 @@ if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)"; } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + $sql .= " AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale)."))"; } } // Search on socid diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8b3bfe00233..028b4f583a9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -788,7 +788,7 @@ class Propal extends CommonObject // Rang to use $ranktouse = $rang; - if ($ranktouse == -1) { + if (empty($ranktouse) || $ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); $ranktouse = $rangmax + 1; } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index cb8a77d902f..30ad014ece8 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -514,12 +514,12 @@ if ($socid > 0) { print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; print ''.$langs->trans("AmountHT").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountHT").''; } print ''.$langs->trans("VATRate").''; print ''.$langs->trans("AmountTTC").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountTTC").''; } print ''.$langs->trans("DiscountOfferedBy").''; @@ -576,12 +576,12 @@ if ($socid > 0) { print ''.price($obj->amount_ht).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ht).''; } print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ttc).''; } print ''; @@ -607,7 +607,7 @@ if ($socid > 0) { } } else { $colspan = 8; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { $colspan += 2; } print ''.$langs->trans("None").''; @@ -814,12 +814,12 @@ if ($socid > 0) { print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; print ''.$langs->trans("AmountHT").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountHT").''; } print ''.$langs->trans("VATRate").''; print ''.$langs->trans("AmountTTC").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountTTC").''; } print ''.$langs->trans("DiscountOfferedBy").''; @@ -871,12 +871,12 @@ if ($socid > 0) { } print ''.$langs->trans("NotConsumed").''; print ''.price($obj->amount_ht).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ht).''; } print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ttc).''; } print ''; @@ -901,7 +901,7 @@ if ($socid > 0) { } } else { $colspan = 8; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { $colspan += 2; } print ''.$langs->trans("None").''; @@ -1142,12 +1142,12 @@ if ($socid > 0) { print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; print ''.$langs->trans("AmountHT").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountHT").''; } print ''.$langs->trans("VATRate").''; print ''.$langs->trans("AmountTTC").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountTTC").''; } print ''.$langs->trans("Author").''; @@ -1223,12 +1223,12 @@ if ($socid > 0) { } print ''; print ''.price($obj->amount_ht).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ht).''; } print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ttc).''; } print ''; @@ -1241,7 +1241,7 @@ if ($socid > 0) { } } else { $colspan = 8; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { $colspan += 2; } print ''.$langs->trans("None").''; @@ -1312,12 +1312,12 @@ if ($socid > 0) { print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; print ''.$langs->trans("AmountHT").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountHT").''; } print ''.$langs->trans("VATRate").''; print ''.$langs->trans("AmountTTC").''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.$langs->trans("MulticurrencyAmountTTC").''; } print ''.$langs->trans("Author").''; @@ -1393,12 +1393,12 @@ if ($socid > 0) { } print ''; print ''.price($obj->amount_ht).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ht).''; } print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''.price($obj->multicurrency_amount_ttc).''; } print ''; @@ -1412,7 +1412,7 @@ if ($socid > 0) { } } else { $colspan = 8; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { $colspan += 2; } print ''.$langs->trans("None").''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0da11bd8d21..053affe5c86 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1780,7 +1780,7 @@ class Commande extends CommonOrder // Rang to use $ranktouse = $rang; - if ($ranktouse == -1) { + if (empty($ranktouse) || $ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); $ranktouse = $rangmax + 1; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 495df373c63..1ba88d168cf 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4410,7 +4410,7 @@ class Facture extends CommonInvoice // Rank to use $ranktouse = $rang; - if ($ranktouse == -1) { + if (empty($ranktouse) || $ranktouse == -1) { $rangmax = $this->line_max($fk_parent_line); $ranktouse = $rangmax + 1; } diff --git a/htdocs/conf/.gitignore b/htdocs/conf/.gitignore index c8dcde9c3fc..6c5c64a5cee 100644 --- a/htdocs/conf/.gitignore +++ b/htdocs/conf/.gitignore @@ -7,3 +7,4 @@ /conf.php.utf8 /conf.php.nov* /.conf.php.swp +/conf.sav diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 51fea29553a..618070a32cf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1234,6 +1234,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' // TODO Change signature of delete for Societe $result = $objecttmp->delete($objecttmp->id, $user, 1); } else { + $objecttmp->oldcopy = dol_clone($objecttmp); $result = $objecttmp->delete($user); } diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 77fa2c6cf9f..8d897379d00 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -66,7 +66,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $action = GETPOST('action', 'aZ09'); $signature = GETPOST('signaturebase64'); -$ref = GETPOST('ref', 'aZ09'); +// Match the filter the producer uses in newonlinesign.php:97 ('alpha'). +// Refs such as PR2601-0003 contain a dash, which aZ09 strips. After stripping +// the dash, dol_verifyHash fails because the security key was built from the +// full reference, so onlineSign answered 403 even on valid submissions (#31464). +$ref = GETPOST('ref', 'alpha'); $mode = GETPOST('mode', 'aZ09'); // 'proposal', ... $SECUREKEY = GETPOST("securekey"); // Secure key $online_sign_name = GETPOST("onlinesignname"); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0b595d16ef1..f9cd0a81d21 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1905,14 +1905,15 @@ class FormTicket if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO') || getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) { $texttooltip .= '

'.$langs->trans("ForEmailMessageWillBeCompletedWith").'...'; } + $allowedmailtags = array('a', 'div', 'strong', 'em', 'i', 'u', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img'); if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO')) { $mail_intro = make_substitutions(getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO'), $this->substit); - print ''; + print ''; $texttooltip .= '
'.$langs->trans("TicketMessageMailIntro").'
'.$mail_intro; } if (getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) { $mail_signature = make_substitutions(getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE'), $this->substit); - print ''; + print ''; $texttooltip .= '

'.$langs->trans("TicketMessageMailFooter").'
'.$mail_signature; } print $form->textwithpicto('', $texttooltip, 1, 'help'); diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 242cba01f08..0cbc6e9c326 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -257,7 +257,7 @@ function generate_random_id($car = 16) for ($i = 0; $i < $car; $i++) { try { $key = random_int(0, $max); - } catch (\Exception $e) { + } catch (Exception $e) { // Fallback. We let PHP makes the seed automatically (no manual mt_srand) $key = mt_rand(0, $max); } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 87be67d907e..e33c78c2db9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -1578,7 +1578,7 @@ if (!empty($object->thirdparty)) { jQuery("#np_markRate, .np_markRate").hide(); } - jQuery("#units, #title_units").hide(); + jQuery("#units, #title_units, .linecoluseunit .selection").hide(); jQuery("#buying_price").show(); jQuery('#trlinefordates, .divlinefordates').show(); } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 6efd589c8db..fb760baae9b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1083,7 +1083,8 @@ if ($action == 'create') { } else { print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); - print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth150 widthcentpercentminusxx maxwidth500'); + $filter = '(s.status:=:1)'; + print $form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth150 widthcentpercentminusxx maxwidth500'); print ' 'create'])]).'">'; print ''; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 95a87195fd0..ff253f9794e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -86,6 +86,11 @@ class Fichinter extends CommonObject */ public $element = 'fichinter'; + /** + * @var string Name of field in database that is used as reference when object is linked to another one. + */ + public $fk_element = 'fk_fichinter'; + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index af12e015779..effda15ab02 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -491,7 +491,7 @@ ALTER TABLE llx_partnership ADD COLUMN email_partnership varchar(64) after fk_me ALTER TABLE llx_contratdet ADD INDEX idx_contratdet_statut (statut); -ALTER TABLE fk_product_price_product DROP FOREIGN KEY fk_product_price_product; +ALTER TABLE llx_product_price DROP FOREIGN KEY fk_product_price_product; ALTER TABLE llx_societe_rib ADD COLUMN ext_payment_site varchar(128); @@ -681,7 +681,7 @@ ALTER TABLE llx_product_lot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT ALTER TABLE llx_product_lot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_product_price_by_qty CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_product_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -ALTER TABLE llx_product_stock_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +ALTER TABLE llx_product_warehouse_properties CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_product_stock CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_projet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; ALTER TABLE llx_projet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; @@ -723,3 +723,6 @@ ALTER TABLE llx_user CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP O ALTER TABLE llx_salary_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- 15.0 -> 16.0 rename llx_advtargetemailing to llx_mailing_advtarget ALTER TABLE llx_mailing_advtarget CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; + +-- 3.6 -> 3.7 typo on llx_adherents ('end with s') and varchar is 128 +ALTER TABLE llx_adherent MODIFY COLUMN societe VARCHAR(128); diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 36259f40cfc..a6918580a4f 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -234,3 +234,5 @@ UPDATE llx_menu SET url = CONCAT(url, '&mode=init') WHERE fk_mainmenu = 'ticket' -- VMYSQL4.1 ALTER TABLE llx_asset_depreciation_options_economic MODIFY COLUMN accelerated_depreciation_option boolean DEFAULT false; -- VPGSQL8.2 ALTER TABLE llx_asset ALTER COLUMN llx_asset_depreciation_options_economic DROP DEFAULT, ALTER COLUMN llx_asset_depreciation_options_economic TYPE boolean USING llx_asset_depreciation_options_economic::integer <> 0, ALTER COLUMN llx_asset_depreciation_options_economic SET DEFAULT false; + +ALTER TABLE llx_adherent MODIFY COLUMN societe VARCHAR(128); diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index 016dcf758ac..5d80d3405b3 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -451,4 +451,6 @@ CREATE TABLE llx_workstation_workstation_extrafields ALTER TABLE llx_workstation_workstation_extrafields ADD INDEX idx_workstation_workstation_extrafields (fk_object); +ALTER TABLE llx_adherent MODIFY COLUMN societe VARCHAR(128); + -- end of migration diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index d619c8904d1..92ffd7ed602 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -21,6 +21,7 @@ NoSubCat=No subcategory. SubCatOf=Subcategory FoundCats=Found tags/categories ImpossibleAddCat=Impossible to add the tag/category %s +ErrorCategoryCannotBeItsOwnParent=A tag/category cannot be its own parent. WasAddedSuccessfully=%s was added successfully. ObjectAlreadyLinkedToCategory=Element is already linked to this tag/category. ProductIsInCategories=Product/service is linked to following tags/categories diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 3a464b934c5..5c18f038180 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1867,7 +1867,7 @@ class Mo extends CommonObject $this->tpl['label'] = ''; if (!empty($line->fk_product) && $line->fk_product > 0) { $productstatic->fetch($line->fk_product); - $productstatic->load_virtual_stock(); + $productstatic->load_stock(); // load_virtual_stock() is done in load_stock() $this->tpl['label'] .= $productstatic->getNomUrl(1); //$this->tpl['label'].= ' - '.$productstatic->label; } else { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 848ef30c61a..769aea587c2 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -626,7 +626,7 @@ class FormProduct if ($mode == 1) { $return .= $lines->short_label; } elseif ($mode == 2) { - $return .= $lines->scale; + $return .= (int) $lines->scale; } else { $return .= $lines->id; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1bb0a45ce0b..e76760791ad 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1453,6 +1453,8 @@ class SupplierProposal extends CommonObject $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->fk_unit = $objp->fk_unit; + $line->fetch_optionals(); + $this->lines[$i] = $line; $i++; @@ -2721,6 +2723,8 @@ class SupplierProposal extends CommonObject $this->lines[$i]->fk_unit = $obj->fk_unit; $this->lines[$i]->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); + $this->lines[$i]->fetch_optionals(); + $i++; } $this->db->free($resql); diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 7369a45ad49..89ea838c80f 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -85,7 +85,7 @@ $formproduct = new FormProduct($db); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_appearance'); -$linkback = ''.img_picto($langs->trans("GoBack"), 'back', 'class="pictofixedwidth"').''.$langs->trans("GoBack").''; +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_admin_prepare_head(); diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 84685e41ad9..f9cd47da91f 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -97,7 +97,7 @@ $arrayofcss = array("/takepos/css/colorbox.css"); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'mod-takepos page-admin_bar'); -$linkback = ''.img_picto($langs->trans("GoBack"), 'back', 'class="pictofixedwidth"').''.$langs->trans("GoBack").''; +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_admin_prepare_head(); diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 83ba2c85d43..89984f3f6b1 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -94,7 +94,7 @@ $form = new Form($db); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_receipt'); -$linkback = ''.img_picto($langs->trans("GoBack"), 'back', 'class="pictofixedwidth"').''.$langs->trans("GoBack").''; +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 389a1dcfc71..151e68a698e 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -143,7 +143,7 @@ $help_url = 'EN:Module_Point_of_sale_(TakePOS)'; llxHeader('', $langs->trans("CashDeskSetup"), $help_url, '', 0, 0, '', '', '', 'mod-takepos page-admin_setup'); -$linkback = ''.img_picto($langs->trans("GoBack"), 'back', 'class="pictofixedwidth"').''.$langs->trans("GoBack").''; +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index c381eb77c8f..9dfd80f1c4e 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -180,7 +180,7 @@ $formproduct = new FormProduct($db); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, '', '', '', 'mod-takepos page-admin_terminal'); -$linkback = ''.img_picto($langs->trans("GoBack"), 'back', 'class="pictofixedwidth"').''.$langs->trans("GoBack").''; +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_admin_prepare_head(); diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index e26369e97a8..d249de6cea5 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -238,13 +238,13 @@ $( document ).ready(function() {

- 1) { ?> - ';"> trans("Floor")." ".$floor; ?> diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 954056a9e15..d5b7358c735 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1162,11 +1162,14 @@ $( document ).ready(function() { } if (getDolGlobalString('TAKEPOS_CONTROL_CASH_OPENING')) { + // Look for any cash control fence created today on this terminal, regardless of its status, + // so the auto-open popup only fires on the first cash control of a calendar day. Without this, + // refreshing the browser the same day after closing a fence used to immediately re-fire the + // popup because the closed fences were filtered out by the status check (#38597). $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE"; $sql .= " entity = ".((int) $conf->entity)." AND "; $sql .= " posnumber = ".((int) $_SESSION["takeposterminal"])." AND "; $sql .= " date_creation > '".$db->idate(dol_get_first_hour(dol_now()))."'"; - $sql .= " AND status = 0 "; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); @@ -1414,7 +1417,9 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { + hasRight('takepos', 'editlines')) { ?> +

fetch($placeid); } - if ($action == "deleteline" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { + if ($action == "deleteline" && ($user->hasRight('takepos', 'editlines') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { /* $permissiontoupdateline = ($user->hasRight('takepos', 'editlines') && ($user->hasRight('takepos', 'editorderedlines') || $line->special_code != "4")); if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { @@ -1032,14 +1032,22 @@ if (empty($reshook)) { $db->commit(); if (count($invoice->lines) == 0) { - $invoice->delete($user); + // Keep an empty draft invoice alive when a non-default customer was + // already attached so deleting the last line does not silently lose + // the customer that was just selected (#38219). Only drop the invoice + // when it is still on the default cashdesk thirdparty (or none). + $defaultsocid = (int) getDolGlobalString('CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]); + $invoicesocid = (int) $invoice->socid; + if ($invoicesocid === 0 || $invoicesocid === $defaultsocid) { + $invoice->delete($user); - if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - header("Location: ".DOL_URL_ROOT."/takepos/public/auto_order.php"); - } else { - header("Location: ".DOL_URL_ROOT."/takepos/invoice.php"); + if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + header("Location: ".DOL_URL_ROOT."/takepos/public/auto_order.php"); + } else { + header("Location: ".DOL_URL_ROOT."/takepos/invoice.php"); + } + exit; } - exit; } } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 78e7f42f1e6..51dd10e6b01 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -709,6 +709,9 @@ if (empty($reshook)) { $permissiondellink = $permissiontoadd; include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; + // Actions to build doc include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';