diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 53383d31023..81ecb17f1cd 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -59,6 +59,34 @@ jobs: key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} # Run all the precommit tools (defined in pre-commit-config.yaml). + - name: Extract PHP version + id: extract-php-version + run: | + PHP_VERSION=$(sed -n 's/.*\$arrayphpmaxversionwarning\s*=\s*array\s*(\s*\([0-9]\+\)\s*,\s*\([0-9]\+\).*/\1.\2/p' htdocs/install/check.php) + echo "PHP_VERSION=$PHP_VERSION" >> $GITHUB_ENV + + - name: Setup PHPCS + uses: shivammathur/setup-php@v2 + # Install proper php version, and also install phpcs which may be needed + if: | + ! cancelled() && + ( + steps.changed-php.outputs.any_changed == 'true' + || + ( + env.gh_event == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) + ) + ) + with: + php-version: ${{ env.PHP_VERSION }} # Version from check.php + coverage: none # disable xdebug, pcov + tools: phpcs + + # Run all the precommit tools (defined into pre-commit-config.yaml). # We can force exclusion of some of them here. - name: Run pre-commit hooks env: @@ -78,27 +106,6 @@ jobs: # files: | # **.php - - name: Setup PHPCS - uses: shivammathur/setup-php@v2 - # Install when we're going to run phpcs - if: | - ! cancelled() && - ( - steps.changed-php.outputs.any_changed == 'true' - || - ( - env.gh_event == 'push' - && ( - github.event.ref == 'refs/heads/develop' - || endsWith(github.event.ref, '.0') - ) - ) - ) - with: - php-version: 8.1 - coverage: none # disable xdebug, pcov - tools: phpcs - - name: Run some pre-commit hooks on selected changed files only if: "! cancelled() && steps.changed-php.outputs.any_changed == 'true'" env: diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c4ea3c8fbce..3e9335a30d1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -861,6 +861,27 @@ if (empty($reshook)) { } } + if ($action == 'update_extras' && $user->hasRight('adherent', 'creer')) { + $object->oldcopy = dol_clone($object, 2); + $attribute_name = GETPOST('attribute', 'restricthtml'); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name); + if ($ret < 0) { + $error++; + } + if (!$error) { + $result = $object->updateExtraField($attribute_name, 'MEMBER_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + if ($error) { + $action = 'edit_extras'; + } + } + // SPIP Management if (is_object($mailmanspip)) { if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') { diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index ede222b86f3..1ec7c21252f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -329,6 +329,8 @@ if ($action == 'update') { $csscontent = dol_string_nohtmltag($csscontent, 2); dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity); + + setEventMessages($langs->trans("RecordSaved"), null); } $_SESSION["mainmenu"] = ""; // The menu manager may have changed diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9df853c1c14..0d129b745a1 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -455,7 +455,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { print ''; print ''; print ''; print ''; print ''; diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index e405727d7ff..8abd76893bc 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -222,6 +222,7 @@ class box_graph_product_distribution extends ModeleBoxes if (empty($data3)) { $showpointvalue = 0; $nocolor = 1; + $data3 = array(array(0 => $langs->trans("None"), 1 => 1)); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 29de7398bac..fe80d234a1f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9374,7 +9374,8 @@ class Form escapeMarkup: function (markup) { return markup; }, // let our custom formatter work // Specify format function for selected item formatSelection: formatSelection, - templateSelection: formatSelection /* For 4.0 */ + templateSelection: formatSelection, /* For 4.0 */ + language: select2arrayoflanguage }); /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 0c95a0d3d55..4a53e4ce571 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -682,6 +682,8 @@ class Translate } } + $str = str_replace('%)', '__percent_parenthesis__', $str); + if (strpos($key, 'Format') !== 0) { try { // @phan-suppress-next-line PhanPluginPrintfVariableFormatString @@ -691,6 +693,8 @@ class Translate } } + $str = str_replace('__percent_parenthesis__', '%)', $str); + // We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities because // we want to keep '"' '' '' '' '' '' '' '
'
' '' '' '
' '' '< ' that are reliable HTML tags inside translation strings. $str = str_replace( diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0d95003080d..1e3f5fe9db2 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2366,11 +2366,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $out .= dol_trunc($libelle, 120); } if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { - $out .= '
'.img_object($langs->trans("ShowEMailing"), "email").' '; $transcode = $langs->trans("Action".$histo[$key]['acode']); $libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing'); + $out .= ''; + $out .= img_object($langs->trans("ShowEMailing"), "email").' '; $out .= dol_trunc($libelle, 120); + $out .= ''; } $out .= ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cb73d130f84..d38ea55a4ec 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -21,8 +21,8 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2022 Charlene Benke - * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2024-2025 MDW + * Copyright (C) 2023-2024 Joachim Kueter * Copyright (C) 2024 Lenin Rivas * Copyright (C) 2024 Josep Lluís Amador Teruel * Copyright (C) 2024 Benoît PASCAL @@ -8586,17 +8586,19 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' // We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace). // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are // using a non conventionnal way to be encoded, to not have them sanitized just after) - $out = preg_replace_callback( - '/&#(x?[0-9][0-9a-f]+;?)/i', - /** - * @param string[] $m - * @return string - */ - static function ($m) { - return realCharForNumericEntities($m); - }, - $out - ); + if (function_exists('realCharForNumericEntities')) { // May not exist when main.inc.php not loaded, for example in a CLI context + $out = preg_replace_callback( + '/&#(x?[0-9][0-9a-f]+;?)/i', + /** + * @param string[] $m + * @return string + */ + static function ($m) { + return realCharForNumericEntities($m); + }, + $out + ); + } // Now we remove all remaining HTML entities starting with a number. We don't want such entities. $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. @@ -9172,23 +9174,33 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null); $substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null); + $substitutionarray['__DATE_CREATION__'] = (isset($object->date_creation) ? dol_print_date($object->date_creation, 'day', false, $outputlangs) : ''); $substitutionarray['__DATE_MODIFICATION__'] = (isset($object->date_modification) ? dol_print_date($object->date_modification, 'day', false, $outputlangs) : ''); $substitutionarray['__DATE_VALIDATION__'] = (isset($object->date_validation) ? dol_print_date($object->date_validation, 'day', false, $outputlangs) : ''); - $substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, 'day', false, $outputlangs) : ''); - $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%d") : ''); - $substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%A") : ''); - $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%m") : ''); - $substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%b") : ''); - $substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%Y") : ''); - $substitutionarray['__DATE_DELIVERY_HH__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%H") : ''); - $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%M") : ''); - $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_delivery) ? dol_print_date($object->date_delivery, "%S") : ''); + + // handle date_delivery: in customer order/supplier order, the property name is delivery_date, in shipment/reception it is date_delivery + $date_delivery = null; + if (property_exists($object, 'date_delivery')) { + $date_delivery = $object->date_delivery; + } elseif (property_exists($object, 'delivery_date')) { + $date_delivery = $object->delivery_date; + } + $substitutionarray['__DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', 0, $outputlangs) : ''); + $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%d") : ''); + $substitutionarray['__DATE_DELIVERY_DAY_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%A") : ''); + $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%m") : ''); + $substitutionarray['__DATE_DELIVERY_MON_TEXT__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%b") : ''); + $substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%Y") : ''); + $substitutionarray['__DATE_DELIVERY_HH__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%H") : ''); + $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%M") : ''); + $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($date_delivery) ? dol_print_date($date_delivery, "%S") : ''); // For backward compatibility (deprecated) $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); - $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->delivery_date) ? dol_print_date($object->delivery_date, 'day', false, $outputlangs) : ''); + + $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($date_delivery) ? dol_print_date($date_delivery, 'day', false, $outputlangs) : ''); $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != 'AvailabilityType'.$object->availability_code ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : ''); $substitutionarray['__EXPIRATION_DATE__'] = (isset($object->fin_validite) ? dol_print_date($object->fin_validite, 'daytext') : ''); diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 34ad5e13b4c..72dc4d55b90 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -60,7 +60,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes { global $conf, $mysoc; - if ((float) $conf->global->MAIN_VERSION_LAST_INSTALL >= 16.0 && $mysoc->country_code != 'FR') { + if ((float) getDolGlobalString('MAIN_VERSION_LAST_INSTALL') >= 16.0 && $mysoc->country_code != 'FR') { $this->prefix = 'SO'; // We use correct standard code "SO = Sale Order" } } diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index d35c7e54889..4d5a4788840 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -415,7 +415,7 @@ class modAdherent extends DolibarrModules 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>1, - 'test'=>'$conf->adherent->enabled', + 'test'=>'isModEnabled("adherent")', 'datestart'=>$datestart ), ); diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 62b15d2116e..2a49109cece 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -527,7 +527,7 @@ class modStock extends DolibarrModules ); $this->import_updatekeys_array[$r] = array('ps.fk_product' => 'Product', 'ps.fk_entrepot' => "Warehouse"); $this->import_run_sql_after_array[$r] = array( // Because we may change data that are denormalized, we must update dernormalized data after. - 'UPDATE '.MAIN_DB_PREFIX.'product as p SET p.stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);' + 'UPDATE '.MAIN_DB_PREFIX.'product as p SET stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.'product_stock ps WHERE ps.fk_product = p.rowid);' ); } diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 8d17be75f40..f643229c7d3 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -205,6 +205,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att if ($object->element == 'salary') { $permok = $user->hasRight('salaries', 'read'); } + if ($object->element == 'member') { + $permok = $user->hasRight('adherent', 'creer'); + } $isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0)); if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 86bf821cd36..c3bdc971328 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -99,6 +99,9 @@ class InterfaceNotification extends DolibarrTriggers $notify = new Notify($this->db); $resultSend = $notify->send($action, $object); if ($resultSend < 0) { + if (!isset($this->errors)) { + $this->errors = []; + } $this->errors = array_merge($this->errors, $notify->errors); return $resultSend; } diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 33ba7e40e00..709465adb0f 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -117,8 +117,9 @@ if (empty($reshook)) { if (!$cancel) { $datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); $dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); - $capital = (float) price2num(GETPOST('capital')); - $rate = (float) price2num(GETPOST('rate')); + + $capital = GETPOSTFLOAT('capital'); + $rate = GETPOSTFLOAT('rate'); if (!$capital) { $error++; @@ -152,7 +153,7 @@ if (empty($reshook)) { $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->fk_project = GETPOSTINT('projectid'); - $object->insurance_amount = GETPOSTINT('insurance_amount'); + $object->insurance_amount = GETPOSTFLOAT('insurance_amount'); $accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance'); @@ -192,7 +193,8 @@ if (empty($reshook)) { $datestart = dol_mktime(12, 0, 0, GETPOSTINT('startmonth'), GETPOSTINT('startday'), GETPOSTINT('startyear')); $dateend = dol_mktime(12, 0, 0, GETPOSTINT('endmonth'), GETPOSTINT('endday'), GETPOSTINT('endyear')); - $capital = (float) price2num(GETPOST('capital')); + + $capital = GETPOSTFLOAT('capital'); if (!$capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); @@ -201,9 +203,10 @@ if (empty($reshook)) { $object->datestart = $datestart; $object->dateend = $dateend; $object->capital = $capital; - $object->nbterm = (float) price2num(GETPOSTINT("nbterm")); - $object->rate = (float) price2num(GETPOST("rate", 'alpha')); - $object->insurance_amount = (float) price2num(GETPOSTINT('insurance_amount')); + + $object->nbterm = GETPOSTINT("nbterm"); + $object->rate = price2num(GETPOST("rate", 'alpha')); + $object->insurance_amount = GETPOSTFLOAT('insurance_amount'); $accountancy_account_capital = GETPOST('accountancy_account_capital'); $accountancy_account_insurance = GETPOST('accountancy_account_insurance'); diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 98ba5d2bba2..38c44eaa9e3 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2020 Maxime DEMAREST +/* Copyright (C) 2014-2025 Alexandre Spangaro + * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -134,6 +134,7 @@ class PaymentLoan extends CommonObject * @var int */ public $bank_account; + /** * @var int */ @@ -159,8 +160,6 @@ class PaymentLoan extends CommonObject */ public function create($user) { - global $conf, $langs; - $error = 0; $now = dol_now(); @@ -257,7 +256,6 @@ class PaymentLoan extends CommonObject */ public function fetch($id) { - global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.fk_loan,"; @@ -330,7 +328,6 @@ class PaymentLoan extends CommonObject */ public function update($user = null, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -421,20 +418,17 @@ class PaymentLoan extends CommonObject */ public function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $this->db->begin(); - if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; - $sql .= " WHERE type='payment_loan' AND url_id=".((int) $this->id); - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { + if ($this->bank_line > 0) { + $accline = new AccountLine($this->db); + $accline->fetch($this->bank_line); + $result = $accline->delete($user); + if ($result < 0) { + $this->errors[] = $accline->error; $error++; - $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -465,22 +459,6 @@ class PaymentLoan extends CommonObject } } - //if (! $error) - //{ - // if (! $notrigger) - // { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - // } - //} - // Commit or rollback if ($error) { foreach ($this->errors as $errmsg) { @@ -535,8 +513,6 @@ class PaymentLoan extends CommonObject */ public function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { - global $conf; - $error = 0; $this->db->begin(); diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index be7b8398f46..6add004e188 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -270,7 +270,7 @@ class Inventory extends CommonObject // Scan existing stock to prefill the inventory $sql = "SELECT ps.rowid, ps.fk_entrepot as fk_warehouse, ps.fk_product, ps.reel,"; if (isModEnabled('productbatch')) { - $sql .= " pb.batch as batch, pb.qty as qty,"; + $sql .= " COALESCE(pb.batch, '') as batch, pb.qty as qty,"; } else { $sql .= " '' as batch, 0 as qty,"; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 04ab04f8332..f827643d2ea 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -982,7 +982,7 @@ if ($action == 'create') { include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php'; $list = ModelePdfReception::liste_modeles($db); - if (is_countable($list) && count($list) > 1) { + if (is_array($list) && count($list) > 1) { print "
"; print '
'.$langs->trans("BoxTitleLastModifiedDonations", $max); - print '...'; + print '...'; print ''.$langs->trans("AmountTTC").''.$langs->trans("DateModificationShort").'
".$langs->trans("DefaultModel")."'; print $form->selectarray('model', $list, getDolGlobalString('RECEPTION_ADDON_PDF')); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1d7278399d1..fa785fc230c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1440,6 +1440,9 @@ class Societe extends CommonObject if (empty($id)) { $id = $this->id; } + if (empty($this->country_id) && !empty($this->country_code)) { + $this->country_id = dol_getIdFromCode($this->db, $this->country_code, 'c_country', 'code', 'rowid'); + } $error = 0; diff --git a/htdocs/theme/dolistore_logo.jpg b/htdocs/theme/dolistore_logo.jpg index 850ed55de9c..75a38060b42 100644 Binary files a/htdocs/theme/dolistore_logo.jpg and b/htdocs/theme/dolistore_logo.jpg differ diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 23e9de3c804..fce2b25fe37 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -431,7 +431,7 @@ if (empty($reshook)) { // Action to add a message (private or not, with email or not). // This may also send an email (concatenated with email_intro and email footer if checkbox was selected) if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $permissiontoread) { - $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "1" ? 1 : 0), 0); + $ret = $object->newMessage($user, $action, GETPOSTINT('private_message'), 0); if ($ret > 0) { if (!empty($backtopage)) { diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index c098ac3c762..0a9a378fb35 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -111,6 +111,8 @@ $permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read' $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write'); $permissiontosimpleedit = ($selfpermission || $usercanadd); +$childids = $user->getAllChildIds(1); + // Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read') //$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2); $ok = false; @@ -123,7 +125,10 @@ if ($user->hasRight('salaries', 'readall')) { if ($user->hasRight('hrm', 'read')) { $ok = true; } -if ($user->hasRight('expensereport', 'lire') && ($user->id == $object->id || $user->hasRight('expensereport', 'readall'))) { +if ($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'readall') && in_array($object->id, $childids))) { + $ok = true; +} +if ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && in_array($object->id, $childids))) { $ok = true; } if (!$ok) { @@ -304,8 +309,6 @@ if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) { $form = new Form($db); $formcompany = new FormCompany($db); -$childids = $user->getAllChildIds(1); - $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; $title = $person_name." - ".$langs->trans('BankAccounts'); $help_url = ''; diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index ae5b2c03595..e819ee4e738 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -49,7 +49,7 @@ if ($langs->defaultlang != 'en_US') { print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; exit(1); } -if (!isModEnabled('adherent')) { +if (!isModEnabled('member')) { print "Error: Module member must be enabled to have significant results.\n"; exit(1); } diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index eecefc38f23..79f40128c59 100644 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -95,7 +95,12 @@ class SocieteTest extends CommonClassTest $localobject = new Societe($db); $localobject->initAsSpecimen(); + + $localobject->country_id = 0; + $localobject->country_code = 'ES'; + $result = $localobject->create($user); + var_dump($localobject);exit; print __METHOD__." result=".$result."\n"; $this->assertLessThanOrEqual($result, 0);