diff --git a/dev/setup/phpunit/setup_conf.sh b/dev/setup/phpunit/setup_conf.sh index f32b4ea44aa..805b0815ed0 100755 --- a/dev/setup/phpunit/setup_conf.sh +++ b/dev/setup/phpunit/setup_conf.sh @@ -147,8 +147,9 @@ if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; the # Compute md5 based on install file contents, and on db prefix + # filefunc.inc.php holds the version, so include it" # shellcheck disable=2046 - sum=$(md5sum $(find "${TRAVIS_BUILD_DIR}/htdocs/install" -type f) | { LC_ALL=C sort ; echo "$DB_PREFIX" ;} | md5sum) + sum=$(md5sum $(find "${TRAVIS_BUILD_DIR}/htdocs/install" -type f ; echo "${TRAVIS_BUILD_DIR}/filefunc.inc.php" ) | md5sum) # shellcheck disable=2046 cnt=$(md5sum $(find "${TRAVIS_BUILD_DIR}/htdocs/install" -type f) | wc) echo "MD5SUM $sum COUNT:$cnt" @@ -219,12 +220,39 @@ if [ "$load_cache" != "1" ] ; then ( cd "${TRAVIS_BUILD_DIR}/htdocs/install" || exit 1 + # Get the target version from the filefunc.inc.php file + target_version=$(sed -n "s/.*define('DOL_VERSION',[[:space:]]*'\\([0-9.]*\\).*/\\1/p" ../filefunc.inc.php) ; echo $target_version + # Default in case that failed + target_version=${target_version:=20.0.0} + + # Sequence of versions for upgrade process (to be completed) VERSIONS=("3.5.0" "3.6.0" "3.7.0" "3.8.0" "3.9.0") VERSIONS+=("4.0.0") VERSIONS+=("5.0.0" "6.0.0" "7.0.0" "8.0.0" "9.0.0") VERSIONS+=("10.0.0" "11.0.0" "12.0.0" "13.0.0" "14.0.0") VERSIONS+=("15.0.0" "16.0.0" "18.0.0" "19.0.0" "20.0.0") - VERSIONS+=("21.0.0") + + # Append versions up to the current dolibarr version + last_version=${VERSIONS[-1]} + + target_major=${target_version%%.*} + last_major=${last_version%%.*} + + # Add versions up to target_version + while (( last_major < target_major )); do + ((last_major++)) + VERSIONS+=("${last_major}.0.0") + done + + # Add target_version if it's not already in the list + last_version=${VERSIONS[-1]} + if [[ "${last_version}" != "${target_version}" ]]; then + VERSIONS+=("$target_version") + fi + + last_version=${VERSIONS[-1]} # Keep last_version up-to-date + + # Proceed with the upgrade process pVer=${VERSIONS[0]} for v in "${VERSIONS[@]:1}" ; do LOGNAME="${TRAVIS_BUILD_DIR}/upgrade${pVer//./}${v//./}" diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c23c6ff6455..4ba7a029122 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -337,7 +337,7 @@ class Facture extends CommonInvoice 'datef' => array('type' => 'date', 'label' => 'DateInvoice', 'enabled' => 1, 'visible' => 1, 'position' => 20), 'date_valid' => array('type' => 'date', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 22), 'date_lim_reglement' => array('type' => 'date', 'label' => 'DateDue', 'enabled' => 1, 'visible' => 1, 'position' => 25), - 'date_closing' => array('type' => 'datetime', 'label' => 'Date closing', 'enabled' => 1, 'visible' => -1, 'position' => 30), + 'date_closing' => array('type' => 'datetime', 'label' => 'DateClosing', 'enabled' => 1, 'visible' => -1, 'position' => 30), 'paye' => array('type' => 'smallint(6)', 'label' => 'InvoicePaidCompletely', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 80), //'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85), //'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90), diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index afd62190cda..c1337f02968 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -10,7 +10,7 @@ * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018-2024 Ferran Marcet * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -1026,7 +1026,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid"; $sql .= " WHERE sc.fk_soc = ".((int) $object->id); $sql .= " AND p.entity IN (".getEntity('project').")"; - $sql .= " AND tc.element = 'project'"; + $sql .= " AND tc.element = 'project' AND tc.source = 'external'"; $sql .= " ORDER BY p.dateo DESC"; $result = $db->query($sql); @@ -1567,7 +1567,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Delete if ($user->hasRight('societe', 'contact', 'delete')) { - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index be2182598d1..9882c04ff67 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6485,7 +6485,7 @@ function print_barre_liste($title, $page, $file, $options = '', $sortfield = '', do { if ($pagenavastextinput) { if ($cpt == $page) { - $pagelist .= ''; + $pagelist .= ''; $pagelist .= '/'; } } else { diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index d32291f3ec9..7a1d9311067 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -66,7 +66,8 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - printTotalValCell($totalarray['type'][$i], $sumsarray[$totalarray['pos'][$i]]); + $fieldname = preg_replace('/[^a-z0-9]/', '', $totalarray['pos'][$i]); + printTotalValCell($totalarray['type'][$i], $sumsarray[$fieldname]); } else { if ($i == 1) { print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 331ff7d85fc..9e0d1f0c9b6 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1517,7 +1517,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // SellBy / EatBy mandatory list if (!empty($sellOrEatByMandatoryList)) { - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, GETPOSTINT('sell_or_eat_by_mandatory')); print ''; } @@ -2142,7 +2142,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $sellOrEatByMandatorySelectedId = $object->sell_or_eat_by_mandatory; } - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, $sellOrEatByMandatorySelectedId); print ''; } @@ -2594,7 +2594,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } - print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print ''.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $object->getSellOrEatByMandatoryLabel(); print ''; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 43d0fcb6113..8814a21706a 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -539,7 +539,7 @@ if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed $sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; $sql .= " s.nom, s.rowid,"; $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut as status"; + $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c363f3fad8c..4d6ed8432c7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -377,10 +377,11 @@ $mesg = ''; * Actions */ +// First log into the dolibarr_payment.log file +dol_syslog("--- newpayment.php action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); + // Action dopayment is called after clicking/choosing the payment mode if ($action == 'dopayment') { // Test on permission not required here (anonymous action protected by mitigation of /public/... urls) - dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); - if ($paymentmethod == 'paypal') { $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); $PAYPAL_PAYMENT_TYPE = 'Sale'; @@ -872,7 +873,6 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -dol_syslog("--- newpayment.php action = ".$action, LOG_DEBUG, 0, '_payment'); dol_syslog("newpayment.php show page source=".$source." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha')." ref=".$ref, LOG_DEBUG, 0, '_payment'); dol_syslog("_SERVER[SERVER_NAME] = ".(empty($_SERVER["SERVER_NAME"]) ? '' : dol_escape_htmltag($_SERVER["SERVER_NAME"])), LOG_DEBUG, 0, '_payment'); dol_syslog("_SERVER[SERVER_ADDR] = ".(empty($_SERVER["SERVER_ADDR"]) ? '' : dol_escape_htmltag($_SERVER["SERVER_ADDR"])), LOG_DEBUG, 0, '_payment'); diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 434248a4277..8647b141458 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -141,19 +141,26 @@ if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete if (!empty($id) && $socid > 0) { $db->begin(); - $sql = "DELETE t, et FROM ".MAIN_DB_PREFIX."socpeople AS t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields AS et ON t.rowid = et.fk_object"; - $sql .= " WHERE t.fk_soc = ".((int) $socid); - $sql .= " AND t.rowid = ".((int) $id); - $sql .= " AND ((t.fk_user_creat = ".((int) $user->id)." AND t.priv = 1) OR t.priv = 0)"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople_extrafields"; + $sql .= " WHERE fk_object = ".((int) $socid); + $sql .= " AND fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople as sp WHERE sp.rowid = ".((int) $socid); + $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0))"; - $result = $db->query($sql); - if (!$result) { + $result1 = $db->query($sql); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; + $sql .= " WHERE fk_soc = ".((int) $socid); + $sql .= " AND rowid = ".((int) $id); + $sql .= " AND ((fk_user_creat = ".((int) $user->id)." AND priv = 1) OR priv = 0)"; + + $result2 = $db->query($sql); + + if (!$result1 || !$result2) { setEventMessages($db->lasterror(), null, 'errors'); $db->rollback(); } else { $db->commit(); - setEventMessages('ContactDeleted', null, 'mesgs'); + setEventMessages('RecordDeleted', null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); exit(); }