diff --git a/.gitignore b/.gitignore index 434764e4f06..a582d0807a3 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ dev/build/node_modules/ node_modules/ vendor/ +php-vendor tmp/ #yarn diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 142d82f7ee8..f2c11adb4db 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -198,6 +198,11 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); $action = ''; } + $subledger_account_str = is_array($subledger_account) ? reset($subledger_account) : (string) $subledger_account; + if (!checkGeneralAccountAllowsAuxiliary($db, $accountingaccount_number, $subledger_account_str)) { + $error++; + setEventMessages($langs->trans("ErrorAccountNotCentralized"). ". " . $langs->trans("RemoveSubsidiaryAccountOrAdjustTheGeneralAccount"), null, 'errors'); + } if (!$error) { if (GETPOSTINT('doc_datemonth') && GETPOSTINT('doc_dateday') && GETPOSTINT('doc_dateyear')) { @@ -520,6 +525,29 @@ if ($action == 'delete') { print $formconfirm; } +// Update fields properties in realtime +if (!empty($conf->use_javascript_ajax)) { + print "\n" . '' . "\n"; +} + if ($action == 'create') { print load_fiche_titre($title); @@ -995,7 +1023,7 @@ if ($action == 'create') { print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } // Add also input for subledger label - print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; + print '
subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; print ''; print 'label_operation).'">'; print 'debit)).'">'; @@ -1022,7 +1050,7 @@ if ($action == 'create') { } else { print ''; } - print '
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 1afde9322b3..e3ac6a47b5b 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -68,11 +68,11 @@ class AdherentStats extends Stats /** - * Constructor + * Constructor * - * @param DoliDB $db Database handler - * @param int $socid Id third party - * @param int $userid Id user for filter + * @param DoliDB $db Database handler + * @param int $socid Id third party + * @param int $userid Id user for filter */ public function __construct($db, $socid = 0, $userid = 0) { @@ -97,11 +97,11 @@ class AdherentStats extends Stats /** - * Return the number of proposition by month for a given year + * Return the number of members by month for a given year * - * @param int $year Year - * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array,array{0:int<1,12>,1:int}> Array of nb each month + * @param int $year Year + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array,array{0:int<1,12>,1:int}> Array of nb each month */ public function getNbByMonth($year, $format = 0) { @@ -136,7 +136,7 @@ class AdherentStats extends Stats * * @param int $year Year * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array,array{0:int<1,12>,1:int|float}> Array of values by month + * @return array,array{0:int<1,12>,1:int|float}> Array of values by month */ public function getAmountByMonth($year, $format = 0) { @@ -375,7 +375,7 @@ class AdherentStats extends Stats 'datem' => $this->db->jdate($objp->datem), 'status' => (int) $objp->status, 'date_end_subscription' => $this->db->jdate($objp->date_end_subscription), - 'photo' => $objp->photo, + 'photo' => isset($objp->photo) ? (string) $objp->photo : null, 'email' => $objp->email, 'gender' => $objp->gender, 'morphy' => $objp->morphy, diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 40a3b69a472..4f7224cc5ee 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -26,6 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherentstats.class.php'; /** @@ -44,6 +45,11 @@ class Members extends DolibarrApi 'typeid' ); + /** + * @var AdherentStats + */ + public $memberstats; + /** * Constructor */ @@ -51,6 +57,7 @@ class Members extends DolibarrApi { global $db; $this->db = $db; + $this->memberstats = new AdherentStats($this->db, DolibarrApiAccess::$user->socid, DolibarrApiAccess::$user->id); } /** @@ -982,6 +989,91 @@ class Members extends DolibarrApi ); } + /** + * Return an array with the number of members by month for a given year + * + * @param int $year Year + * @param int $format 0=Label of abscissa is a translated text + * 1=Label of abscissa is month number + * 2=Label of abscissa is first letter of month + * @return array Array of statistics for last modified members + * @phan-return array,array{0:int<1,12>,1:int}> Array of nb each month + * @phpstan-return array,array{0:int<1,12>,1:int}> Array of nb each month + * + * @url GET stats/nbbymonth + * @throws RestException 403 Access denied + */ + public function getNbByMonth($year, $format = 0) + { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { + throw new RestException(403); + } + + return $this->memberstats->getNbByMonth($year, $format); + } + + /** + * Return an array with the number of subscriptions by year + * + * @return array Array of statistics for last modified members + * @phan-return array Array of nb each year + * @phpstan-return array Array of nb each year + * + * @url GET stats/nbbyyear + * @throws RestException 403 Access denied + */ + public function getNbByYear() + { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { + throw new RestException(403); + } + + return $this->memberstats->getNbByYear(); + } + + /** + * Return the number of subscriptions by month for a given year + * + * @param int $year Year + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array Array of statistics for last modified members + * @phan-return array,array{0:int<1,12>,1:int|float}> Array of values by month + * @phpstan-return array,array{0:int<1,12>,1:int|float}> Array of values by month + * + * @url GET stats/amountbymonth + * @throws RestException 403 Access denied + */ + public function getAmountByMonth($year, $format = 0) + { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { + throw new RestException(403); + } + + return $this->memberstats->getAmountByMonth($year, $format); + } + + /** + * Last Modified Members + * + * Get an array of statistics for last modified members + * + * @param int $max Max numbers of members + * @return array Array of statistics for last modified members + * @phan-return array + * @phpstan-return array + * + * @url GET stats/lastmodifiedmembers + * @throws RestException 403 Access denied + */ + public function getLastModifiedMembers($max) + { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) { + throw new RestException(403); + } + + return $this->memberstats->getLastModifiedMembers($max); + } + /** * Validate fields before creating an object * diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 7b6c8c704a3..1b9358901bd 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -127,13 +127,14 @@ if ($conf->use_javascript_ajax) { } } - $dataseries = array(); - $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), $sumMembers['total']['members_draft']); // Draft, not yet validated - $dataseries[] = array($langs->transnoentitiesnoconv("WaitingSubscription"), $sumMembers['total']['members_pending']); - $dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), $sumMembers['total']['members_uptodate']); - $dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), $sumMembers['total']['members_expired']); - $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']); - $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']); + $dataseries = [ + [$langs->transnoentitiesnoconv("MembersStatusToValid"), $sumMembers['total']['members_draft']], // Draft, not yet validated + [$langs->transnoentitiesnoconv("WaitingSubscription"), $sumMembers['total']['members_pending']], + [$langs->transnoentitiesnoconv("UpToDate"), $sumMembers['total']['members_uptodate']], + [$langs->transnoentitiesnoconv("OutOfDate"), $sumMembers['total']['members_expired']], + [$langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']], + [$langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']], + ]; /** * @var string $badgeStatus0 diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a38a8fb3466..4d22c6eebd2 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -799,7 +799,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter .= ''; if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) { $moreforfilter .= ' '; - $moreforfilter .= ''; + $moreforfilter .= ''; } $moreforfilter .= ''; $moreforfilter .= ''; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index cfbf8d0f98c..0d4b1c08751 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -252,7 +252,7 @@ if (empty($error) && !empty($xml)) { $out .= ''."\n"; $out .= ''.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("BlockedLog")).''."\n"; $out .= ''.yn(1).''."\n"; - $out .= ''.yn(isModEnabled('blockedlog')).''."\n"; + $out .= ''.yn(isModEnabled('blockedlog') ? 1 : 0).''."\n"; $out .= "\n"; } diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 4b568428fb4..e4d888a2879 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -94,9 +94,9 @@ class BlockedLog public $linktype = ''; /** - * @var string $linkref + * @var string $linktoref */ - public $linkref = ''; + public $linktoref = ''; /** * Object element diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b71688ae289..d4ce92960fa 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -594,7 +594,7 @@ $sql .= " typent.code as typent_code,"; $sql .= " ava.rowid as availability,"; $sql .= " country.code as country_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,'; +$sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.import_key, p.fk_user_author, p.datep as dp, p.fin_validite as dfv, p.date_livraison as ddelivery,'; $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,'; $sql .= ' p.datec as date_creation, p.tms as date_modification, p.date_cloture as date_cloture,'; $sql .= ' p.date_signature as dsignature,'; @@ -1944,7 +1944,7 @@ while ($i < $imaxinloop) { // Other picto tool print ''; $filename = dol_sanitizeFileName($obj->ref); - $filedir = $conf->propal->multidir_output[$obj->propal_entity].'/'.dol_sanitizeFileName($obj->ref); + $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($object->element, $filename, $filedir); print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index c9222325fec..edcf9c72956 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1857,7 +1857,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) { } // Company type if (!empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); print ''; } @@ -2598,7 +2598,7 @@ while ($i < $imaxinloop) { // Country if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray = getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 1ce62ce4c9e..7d7c58d756d 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -431,6 +431,19 @@ if ($action == 'create') { $(\'#fieldchqemetteur\').val(\'\'); } } + function toggleSubledger() { + var isCentral = $("#accountancy_code option:selected").data("centralized"); + console.log("the selected general ledger account is centralised?", isCentral); + if (isCentral) { + $("#subledger_account").prop("disabled", false); + } else { + $("#subledger_account").prop("disabled", true); + } + } + toggleSubledger(); + + $("#accountancy_code").on("change", toggleSubledger); + $("#accountancy_code").on("select2:select", toggleSubledger); '; print ' });'."\n"; diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 66ab2787106..b4da5819ff5 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -84,10 +84,10 @@ class box_last_modified_ticket extends ModeleBoxes $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; $sql .= ", s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as tef ON tef.fk_object=t.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as tef ON tef.fk_object = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code = t.type_code AND type.entity = t.entity"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code = t.category_code AND category.entity = t.entity"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code = t.severity_code AND severity.entity = t.entity"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; $sql .= " WHERE t.entity IN (".getEntity('ticket').')'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 570805aa43f..5a169c17fd5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2211,7 +2211,7 @@ class Form global $action; // If no preselected user defined, we take current user - if ((is_numeric($selected) && ($selected < -3 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) { + if ((is_numeric($selected) && ($selected < -4 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) { $selected = $user->id; } @@ -2388,6 +2388,18 @@ class Form 'picto' => '' ); } + if ($showalso == 4) { + $out .= '' . "\n"; + + $outarray[-4] = '-- ' . $langs->trans("AllProjectContacts") . ' --'; + $outarray2[-4] = array( + 'id' => -4, + 'label' => '-- ' . $langs->trans("AllProjectContacts") . ' --', + 'labelhtml' => '-- ' . $langs->trans("AllProjectContacts") . ' --', + 'color' => '', + 'picto' => '' + ); + } $userstatic = new User($this->db); @@ -4230,7 +4242,7 @@ class Form $outvallabel .= ' ' . $langs->transnoentities("Units"); } - if ($objp->quantity > 1) { + if ($objp->quantity != 1) { $optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding $outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 93900c30ae0..3bfe4918ea3 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2015 Ari Elbaz (elarifr) - * Copyright (C) 2016 Marcos García - * Copyright (C) 2016-2024 Alexandre Spangaro +/* Copyright (C) 2013-2016 Florian Henry + * Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2015 Ari Elbaz (elarifr) + * Copyright (C) 2016 Marcos García + * Copyright (C) 2016-2025 Alexandre Spangaro * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; class FormAccounting extends Form { /** - * @var array> + * @var array|array>> */ private $options_cache = array(); @@ -457,7 +457,10 @@ class FormAccounting extends Form $selected = $select_value_out; } - $options[$select_value_out] = $label; + $options[$select_value_out] = array( + 'label' => $label, + 'data-centralized' => $obj->centralized ? 1 : 0 + ); } } diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 0bce2df7ebf..1c5843a9969 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -1039,6 +1039,12 @@ class Notify 'notification' ); + if (! empty($mailfile->error) || ! empty($mailfile->errors)) { + $this->error = $mailfile->error; + $this->errors = $mailfile->errors; + return -1; + } + if ($mailfile->sendfile()) { if ($obj->type_target == 'touserid') { $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)"; @@ -1360,6 +1366,12 @@ class Notify 'notification' ); + if (! empty($mailfile->error) || ! empty($mailfile->errors)) { + $this->error = $mailfile->error; + $this->errors = $mailfile->errors; + return -1; + } + if ($mailfile->sendfile()) { $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)"; $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($sendto)."')"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b3660bfe683..5682eda94a7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8478,7 +8478,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id /** * Return yes or no in current language * - * @param int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (1, 'yes', 'true' or 0, 'no', 'false') + * @param boolean|int<0, 1>|'yes'|'true'|'no'|'false' $yesno Value to test (true, 1, 'yes', 'true' or false, 0, 'no', 'false') * @param integer|string $format 1=Yes/No, 0=yes/no, 2=Disabled/enabled checkbox, 3=Disabled/enabled checkbox + Yes/No, 4 or Text=Use picto * @param int $color 0=texte only, 1=Text is formatted with a color font style ('ok' or 'error'), 2=Text is formatted with 'ok' color. * @return string HTML string @@ -8489,7 +8489,7 @@ function yn($yesno, $format = 1, $color = 0) $result = 'unknown'; $classname = ''; - if ($yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // To set to 'no' before the test because of the '== 0' + if ($yesno === true || (int) $yesno == 1 || (isset($yesno) && (strtolower($yesno) == 'yes' || strtolower($yesno) == 'true'))) { // To set to 'no' before the test because of the '== 0' $result = $langs->trans('yes'); if ($format == 1 || $format == 3) { $result = $langs->trans("Yes"); @@ -8505,7 +8505,7 @@ function yn($yesno, $format = 1, $color = 0) } $classname = 'ok'; - } elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') { + } else { $result = $langs->trans("no"); if ($format == 1 || $format == 3) { $result = $langs->trans("No"); @@ -14644,6 +14644,20 @@ function getElementProperties($elementType) $classname = 'Fournisseur'; $table_element = 'societe'; $subelement = ''; + } elseif ($elementType == 'recruitmentcandidature') { + $module = 'recruitment'; + $classfile = 'recruitmentcandidature'; + $classpath = 'recruitment/class'; + $classname = 'RecruitmentCandidature'; + $subelement = 'recruitmentcandidature'; + $subdir = '/recruitmentcandidature'; + } elseif ($elementType == 'recruitmentjobposition') { + $module = 'recruitment'; + $classfile = 'recruitmentjobposition'; + $classpath = 'recruitment/class'; + $classname = 'RecruitmentJobPosition'; + $subelement = 'recruitmentjobposition'; + $subdir = '/recruitmentjobposition'; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 5e5ff698d6c..8aa1965e5ad 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2653,7 +2653,7 @@ function getModuleDirForApiClass($moduleobject) $moduledirforclass = 'contrat'; } elseif (in_array($moduleobject, array('admin', 'login', 'setup', 'access', 'status', 'tools', 'documents', 'objectlinks'))) { $moduledirforclass = 'api'; - } elseif ($moduleobject == 'contact' || $moduleobject == 'contacts' || $moduleobject == 'customer' || $moduleobject == 'thirdparty' || $moduleobject == 'thirdparties') { + } elseif (in_array($moduleobject, ['contact', 'contacts', 'customer', 'thirdparty', 'thirdparties'])) { $moduledirforclass = 'societe'; } elseif ($moduleobject == 'propale' || $moduleobject == 'proposals') { $moduledirforclass = 'comm/propal'; @@ -2661,7 +2661,7 @@ function getModuleDirForApiClass($moduleobject) $moduledirforclass = 'comm/action'; } elseif ($moduleobject == 'mailing') { $moduledirforclass = 'comm/mailing'; - } elseif ($moduleobject == 'adherent' || $moduleobject == 'members' || $moduleobject == 'memberstypes' || $moduleobject == 'subscriptions') { + } elseif (in_array($moduleobject, ['adherent', 'members', 'memberstypes', 'subscriptions'])) { $moduledirforclass = 'adherents'; } elseif ($moduleobject == 'don' || $moduleobject == 'donations') { $moduledirforclass = 'don'; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index e2efbf55e37..8699366726c 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -99,7 +99,7 @@ class InterfaceNotification extends DolibarrTriggers $notify = new Notify($this->db); $resultSend = $notify->send($action, $object); if ($resultSend < 0) { - $this->errors = array_merge(empty($this->errors) ? array() : $this->errors, $notify->errors); + $this->errors = array_merge(empty($this->errors) ? array() : $this->errors, empty($notify->error) ? array() : array($notify->error), $notify->errors); return $resultSend; } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 920221a9afa..d000a01c5e5 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1024,6 +1024,7 @@ class Cronjob extends CommonObject $object->datelastrun = null; $object->lastresult = ''; $object->datelastresult = null; + $object->datenextrun = dol_now(); $object->lastoutput = ''; $object->nbrun = 0; diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 3fed4f40761..4a9e29df6e6 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -256,6 +256,7 @@ VATIntraSyntaxIsValid=Syntax is valid VATPaymentFrequency=VAT payment frequency ProspectCustomer=Prospect / Customer Prospect=Prospect +ProspectsOrCustomers=Prospects or customers CustomerCard=Customer Card Customer=Customer CustomerRelativeDiscount=Relative customer discount diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fa1d4d0dada..e9f5c6c670e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1395,3 +1395,4 @@ NeedHelpCenter=Need support? Efficiency=Efficiency AccordingToYourSetupTheFileWillBeConcatenated=According to your setup, the file %s (uploaded in module setup) will be concatenated to any generated PDF TransactionID=Transaction ID +AllProjectContacts=All project contacts \ No newline at end of file diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index aa0d59ce6df..c5f27da8e80 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -156,7 +156,7 @@ class modMyModule extends DolibarrModules $this->langfiles = array("mymodule@mymodule"); // Prerequisites - $this->phpmin = array(7, 1); // Minimum version of PHP required by module + $this->phpmin = array(7, 2); // Minimum version of PHP required by module // $this->phpmax = array(8, 0); // Maximum version of PHP required by module $this->need_dolibarr_version = array(19, -3); // Minimum version of Dolibarr required by module // $this->max_dolibarr_version = array(19, -3); // Maximum version of Dolibarr required by module diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2352365218b..9ae3c7e28da 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2435,7 +2435,8 @@ class Product extends CommonObject $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; $price_min_ttc = $this->multiprices_min_ttc[$thirdparty_buyer->price_level]; $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; - if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { + // using this option is a bug. kept for backward compatibility if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) { $tva_tx = $this->multiprices_tva_tx[$thirdparty_buyer->price_level]; } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 07655f8123b..3b1ee88105f 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -229,7 +229,7 @@ if ($object->id > 0 && $upload_dir !== null) { $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); - print dol_get_fiche_head($head, 'documents', $titre, -1, $picto); + print dol_get_fiche_head($head, 'documents', $titre, -1, $picto, 0, '', '', 0, '', 1); $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index 6c5884dd55f..43b0805e5e7 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -972,11 +972,11 @@ if ($id > 0 || $ref) { 'pfp.supplier_reputation' => array('label' => $langs->trans("ReputationForThisProduct"), 'checked' => '-1', 'position' => 14), 'pfp.fk_barcode_type' => array('label' => $langs->trans("BarcodeType"), 'enabled' => (string) (int) isModEnabled('barcode'), 'checked' => '0', 'position' => 15), 'pfp.barcode' => array('label' => $langs->trans("BarcodeValue"), 'enabled' => (string) (int) isModEnabled('barcode'), 'checked' => '0', 'position' => 16), - 'pfp.packaging' => array('label' => $langs->trans("PackagingForThisProduct"), 'enabled' => (string) getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING'), 'checked' => '0', 'position' => 17), - 'pfp.status' => array('label' => $langs->trans("Status"), 'enabled' => '1', 'checked' => '0', 'position' => 40), - 'pfp.tms' => array('label' => $langs->trans("DateModification"), 'enabled' => '1', 'checked' => '1', 'position' => 50), + 'pfp.packaging' => array('label' => $langs->trans("PackagingForThisProduct"), 'enabled' => (string) getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING'), 'checked' => (getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING') ? '1' : '0'), 'position' => 17), 'pfp.price' => array('label' => $langs->trans("PriceQtyMinHT"), 'enabled' => '1', 'checked' => '1', 'position' => 60), 'pfp.multicurrency_price' => array('label' => $langs->trans("PriceQtyMinHTCurrency"), 'enabled' => (string) (int) isModEnabled('multicurrency'), 'checked' => '1', 'position' => 70), + 'pfp.tms' => array('label' => $langs->trans("DateModification"), 'enabled' => '1', 'checked' => '-1', 'position' => 80), + 'pfp.status' => array('label' => $langs->trans("Status"), 'enabled' => '1', 'checked' => '0', 'position' => 200), ); // fetch optionals attributes and labels diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 1cd4f21f0bd..5b58f7e9fe4 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2025 MDW + * Copyright (C) 2025 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -84,20 +85,24 @@ class Warehouses extends DolibarrApi * * Get a list of warehouses * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names - * @return array Array of warehouse objects + * @since 4.0.0 Initial implementation + * @since 23.0.0 Data pagination + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names + * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* + * @return array Array of warehouse objects * @phan-return Entrepot[] * @phpstan-return Entrepot[] * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '', $properties = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '', $properties = '', $pagination_data = false) { $obj_ret = array(); @@ -125,6 +130,9 @@ class Warehouses extends DolibarrApi } } + //this query will return total warehouses with the filters given + $sqlTotals = str_replace('SELECT t.rowid', 'SELECT count(t.rowid) as total', $sql); + $sql .= $this->db->order($sortfield, $sortorder); if ($limit) { if ($page < 0) { @@ -152,6 +160,23 @@ class Warehouses extends DolibarrApi throw new RestException(503, 'Error when retrieve warehouse list : '.$this->db->lasterror()); } + //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit) + if ($pagination_data) { + $totalsResult = $this->db->query($sqlTotals); + $total = $this->db->fetch_object($totalsResult)->total; + + $tmp = $obj_ret; + $obj_ret = []; + + $obj_ret['data'] = $tmp; + $obj_ret['pagination'] = [ + 'total' => (int) $total, + 'page' => $page, //count starts from 0 + 'page_count' => ceil((int) $total / $limit), + 'limit' => $limit + ]; + } + return $obj_ret; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 43e849bfbfe..954082decd6 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -391,7 +391,21 @@ if ($action == 'createtask' && $user->hasRight('projet', 'creer')) { $taskid = $task->create($user); if ($taskid > 0) { - $result = $task->add_contact(GETPOSTINT("userid"), 'TASKEXECUTIVE', 'internal'); + $userid = GETPOSTINT("userid"); + if ($userid == -4) { + if (empty($object->id)) { + $object->fetch($projectid); + } + $contactlist = array(); + foreach (array('internal', 'external') as $source) { + $contactlist = array_merge($contactlist, $object->liste_contact(-1, $source)); + } + foreach ($contactlist as $key => $contact) { + $result = $task->add_contact(((int) $contact["id"]), ($contact["code"] == "PROJECTLEADER" ? 'TASKEXECUTIVE' : "TASKCONTRIBUTOR"), $contact["source"]); + } + } else { + $result = $task->add_contact(GETPOSTINT("userid"), 'TASKEXECUTIVE', 'internal'); + } } else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("projects"); @@ -819,12 +833,12 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''.$langs->trans("AffectedTo").''; print img_picto('', 'user', 'class="pictofixedwidth"'); if (is_array($contactsofproject) && count($contactsofproject)) { - print $form->select_dolusers($user->id, 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx'); + print $form->select_dolusers('-4', 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '(statut:=:1)', 4, '', 'maxwidth500 widthcentpercentminusx'); } else { if ((isset($projectid) && $projectid > 0) || $object->id > 0) { print ''.$langs->trans("NoUserAssignedToTheProject").''; } else { - print $form->select_dolusers($user->id, 'userid', 0, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx'); + print $form->select_dolusers('-4', 'userid', 0, null, 0, '', '', '0', 0, 0, '(statut:=:1)', 4, '', 'maxwidth500 widthcentpercentminusx'); } } print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index ce1bc0f7ea4..b94726695f7 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -808,13 +808,13 @@ if ($id > 0 || !empty($ref)) { /* * Generated documents */ - $filename = ''; - $filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $subdir = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $filedir = $conf->project->multidir_output[$object->entity]."/".$subdir; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = ($user->hasRight('projet', 'lire')); $delallowed = ($user->hasRight('projet', 'creer')); - print $formfile->showdocuments('project_task', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf); + print $formfile->showdocuments('project_task', $subdir, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0, '', '', '', '', '', $object); // Show links to link elements $tmparray = $form->showLinkToObjectBlock($object, array(), array('project_task'), 1); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index c98c546e1cd..3b0a50771db 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -310,7 +310,7 @@ if ($action == 'create') { print ''; } - print dol_get_fiche_head(array(), ''); + print dol_get_fiche_head([], ''); print ''."\n"; @@ -370,7 +370,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = recruitmentCandidaturePrepareHead($object); - print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + print dol_get_fiche_head($head, 'card', $langs->trans("RecruitmentCandidature"), -1, $object->picto, 0, '', '', 0, '', 1); $formconfirm = ''; diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index 6cca73b990f..214e860fd9f 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -118,7 +118,7 @@ if ($object->id && $upload_dir !== null) { */ $head = recruitmentCandidaturePrepareHead($object); - print dol_get_fiche_head($head, 'document', $langs->trans("RecruitmentCandidature"), -1, $object->picto); + print dol_get_fiche_head($head, 'document', $langs->trans("RecruitmentCandidature"), -1, $object->picto, 0, '', '', 0, '', 1); // Build file list diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 7ac9444a0f1..acacc0b4ade 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -241,7 +241,8 @@ if ($id > 0 || !empty($ref)) { $sql .= " t.libelle as type_label, t.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; - $sql .= " WHERE d.fk_soc = ".((int) $id); + $sql .= " WHERE d.entity IN (".getEntity('member').")"; + $sql .= " AND d.fk_soc = ".((int) $id); $sql .= " AND d.fk_adherent_type = t.rowid"; dol_syslog("get list sql=".$sql); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index f8f2718cb8e..0875292593e 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -883,7 +883,7 @@ if (empty($reshook)) { $desc, (float) $pu_ht, (float) $qty, - $tva_tx, + $tva_tx, // don't cast to float $localtax1_tx, $localtax2_tx, $idprod, diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 245349eb870..b18800d8792 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -458,7 +458,7 @@ if (isModEnabled('receiptprinter')) { print ' ('.$langs->trans("MainPrinterToUseMore").')'; print ''; print '
'; - if (!$customprinterallowed) { + if (!$customprinterallowed) { // @phpstan-ignore-line print ''.$langs->trans("NotAvailableForCountryWhenModuleIsOn", $mysoc->country_code, $langs->transnoentitiesnoconv('Module3200Name')).''; } else { print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$terminal), 1); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 7997bcbbd14..faf1efec99b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1343,7 +1343,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) { trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")), null, 'errors'); } @@ -1354,7 +1354,7 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) { $sql .= " AND active = 1"; $sql .= " ORDER BY libelle"; - $resql = $db->query($sql); + $resql = $db->query($sql); $paiementsModes = array(); if ($resql) { while ($obj = $db->fetch_object($resql)) { @@ -1449,7 +1449,7 @@ if (getDolGlobalString('TAKEPOS_BAR_RESTAURANT')) { } else { $menus[$r++] = array('title' => '
'.$langs->trans("PrintTicket").'
', 'action' => 'TakeposPrinting(placeid);'); } - } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { + } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line // Button Print Receipt on special printer $menus[$r++] = array('title' => '
'.$langs->trans("PrintTicket").'
', 'action' => 'DolibarrTakeposPrinting(placeid);'); } else { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 403e7cdcd23..ff79d9a72a0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1331,7 +1331,7 @@ if (empty($reshook)) { } else { $sectionwithinvoicelink .= ' '; } - } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { + } elseif ($customprinterallowed && (isModEnabled('receiptprinter') && getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$term) > 0) || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { // @phpstan-ignore-line // If we set to use a specific receipt printer $sectionwithinvoicelink .= ' '; } else { diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index daf4a37da60..0bffff2fcb4 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -339,9 +339,9 @@ if ($user->hasRight('ticket', 'read')) { $sql .= " category.code as category_code, category.label as category_label,"; $sql .= " severity.code as severity_code, severity.label as severity_label"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code = t.type_code AND type.entity = t.entity"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code = t.category_code AND category.entity = t.entity"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code = t.severity_code AND severity.entity = t.entity"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 8d8678fe456..0528d43a504 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -763,7 +763,7 @@ class Users extends DolibarrApi throw new RestException(404, 'Group not found'); } - return $this->_cleanObjectDatas($group_static); + return $this->_cleanUserGroup($group_static); } /** @@ -1148,6 +1148,109 @@ class Users extends DolibarrApi return $object; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Clean sensible usergroup object datas + * + * @param Object $object Object to clean + * @return Object Object with cleaned properties + */ + private function _cleanUserGroup($object) + { + // phpcs:enable + $object = parent::_cleanObjectDatas($object); + + unset($object->actiontypecode); + unset($object->all_permissions_are_loaded); + unset($object->array_languages); + unset($object->array_options); + unset($object->barcode_type_coder); + unset($object->barcode_type); + unset($object->canvas); + unset($object->civility_code); + unset($object->civility_id); + unset($object->clicktodial_loaded); + unset($object->cond_reglement_id); + unset($object->cond_reglement_supplier_id); + unset($object->contact_id); + unset($object->contacts_ids_internal); + unset($object->contacts_ids); + unset($object->country_code); + unset($object->country_id); + unset($object->date_cloture); + unset($object->date_creation); + unset($object->date_modification); + unset($object->date_validation); + unset($object->default_values); + unset($object->demand_reason_id); + unset($object->deposit_percent); + unset($object->extraparams); + unset($object->firstname); + unset($object->fk_account); + unset($object->fk_delivery_address); + unset($object->fk_incoterms); + unset($object->fk_multicurrency); + unset($object->fk_project); + unset($object->fk_user_creat); + unset($object->fk_user_modif); + unset($object->globalgroup); + unset($object->import_key); + unset($object->last_main_doc); + unset($object->lastname); + unset($object->lastsearch_values_tmp); + unset($object->lastsearch_values); + unset($object->ldap_sid); + unset($object->libelle_incoterms); + unset($object->lines); + unset($object->linkedObjectsIds); + unset($object->location_incoterms); + unset($object->members); + unset($object->mode_reglement_id); + unset($object->module); + unset($object->multicurrency_code); + unset($object->multicurrency_total_ht); + unset($object->multicurrency_total_localtax1); + unset($object->multicurrency_total_localtax2); + unset($object->multicurrency_total_ttc); + unset($object->multicurrency_total_tva); + unset($object->multicurrency_tx); + unset($object->nb_rights); + unset($object->nb_users); + unset($object->origin_id); + unset($object->origin_type); + unset($object->product); + unset($object->ref_ext); + unset($object->ref); + unset($object->region_id); + unset($object->retained_warranty_fk_cond_reglement); + unset($object->rights); + unset($object->search_sid); + unset($object->shipping_method_id); + unset($object->shipping_method); + unset($object->specimen); + unset($object->state_id); + unset($object->status); + unset($object->statut); + unset($object->total_ht); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + unset($object->total_tva); + unset($object->totalpaid_multicurrency); + unset($object->totalpaid); + unset($object->transport_mode_id); + unset($object->TRIGGER_PREFIX); + unset($object->user_closing_id); + unset($object->user_creation_id); + unset($object->user_modification_id); + unset($object->user_validation_id); + unset($object->user); + unset($object->usergroup_entity); + unset($object->warehouse_id); + + return $object; + } + /** * Clean sensible user group list datas * diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 11eced74db7..0c18ad04a42 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -178,6 +178,7 @@ class UserGroup extends CommonObject } $this->name = $this->nom; // For compatibility with field name + $this->note_private = $this->note; // For compatibility with old field note if ($result) { if ($load_members) { diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 71fed54897c..57e177c9ee8 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -157,7 +157,7 @@ if ($object->id && $upload_dir !== null) { } $head = user_prepare_head($object); - print dol_get_fiche_head($head, 'document', $langs->trans("User"), -1, 'user'); + print dol_get_fiche_head($head, 'document', $langs->trans("User"), -1, 'user', 0, '', '', 0, '', 1); $linkback = ''; if ($user->hasRight("user", "user", "read") || $user->admin) {