diff --git a/ChangeLog b/ChangeLog index fd04d5b5107..d6df6f9a14c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -117,6 +117,7 @@ NEW: Accountancy - Add actions on entries (Cloning, assigning, returning) NEW: Add conf PDF_HIDE_LINKED_OBJECT_IN_PUBLIC_NOTE to hide linked object in public note of pdf. NEW: Add MULTICURRENCY_SHOW_ALSO_MAIN_CURRENCY_ON_PDF for legal requirement that need both currencies on PDF NEW: Add note public and private on order export +NEW: Finish dev for API_ENABLE_COUNT_CALLS (count of API use is visible on user API key field) For developers: ---------- diff --git a/htdocs/admin/tools/ui/class/documentation.class.php b/htdocs/admin/tools/ui/class/documentation.class.php index f7064c29d6e..0b869adf800 100644 --- a/htdocs/admin/tools/ui/class/documentation.class.php +++ b/htdocs/admin/tools/ui/class/documentation.class.php @@ -284,7 +284,7 @@ class Documentation top_htmlhead('', $title, 0, 0, $arrayofjs, $arrayofcss); - print ''; + print ''; } /** diff --git a/htdocs/admin/tools/ui/css/documentation.css b/htdocs/admin/tools/ui/css/documentation.css index f493be974ee..9889ba52270 100644 --- a/htdocs/admin/tools/ui/css/documentation.css +++ b/htdocs/admin/tools/ui/css/documentation.css @@ -109,6 +109,7 @@ body.dolibarr-doc { /* Documentation summary */ .doc-wrapper .doc-content-wrapper .summary-wrapper {margin-bottom: 32px;} +.doc-wrapper-bis .doc-content-wrapper .summary-wrapper {margin-bottom: 32px;} .doc-wrapper .doc-content-wrapper ul.documentation-summary {margin: 0;padding: 0;color: rgba(0, 0, 0, .25);} .doc-wrapper .doc-content-wrapper ul.documentation-summary li {list-style: disc;margin-left: 16px;} .doc-wrapper .doc-content-wrapper ul.documentation-summary li ul {margin: 0;padding: 0 ;color: rgba(0, 0, 0, .25);} diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index c0fea9b98bf..05ea3534891 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -796,8 +796,8 @@ if ($resql) { print ''; print ''; print ''; - if (!empty($view)) { - print ''; + if (!empty($mode)) { + print ''; } print ''; print ''; @@ -845,7 +845,7 @@ if ($resql) { print ''; print ' '; print ''; - $form->select_types_paiements((GETPOST('operation') ? GETPOST('operation') : ($object->type == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1); + print $form->select_types_paiements((GETPOST('operation') ? GETPOST('operation') : ($object->type == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1, 0, 0, 1, '', 1); print ''; print ''; print ''; @@ -853,7 +853,7 @@ if ($resql) { //if (! $search_account > 0) //{ print ''; - $form->select_comptes(GETPOSTINT('add_account') ? GETPOSTINT('add_account') : $search_account, 'add_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : '')); + print $form->select_comptes(GETPOSTINT('add_account') ? GETPOSTINT('add_account') : $search_account, 'add_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, '', 1); print ''; //} print ''; @@ -1138,7 +1138,7 @@ if ($resql) { } // Type if (!empty($arrayfields['type']['checked'])) { - print ''; + print ''; print $form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100', 1); print ''; } @@ -1240,7 +1240,7 @@ if ($resql) { $totalarray['nbfield']++; } if (!empty($arrayfields['type']['checked'])) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['b.num_chq']['checked'])) { @@ -1670,13 +1670,13 @@ if ($resql) { if (!empty($arrayfields['type']['checked'])) { $labeltype = ($langs->transnoentitiesnoconv("PaymentTypeShort".$objp->fk_type) != "PaymentTypeShort".$objp->fk_type) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$objp->fk_type) : $langs->getLabelFromKey($db, $objp->fk_type, 'c_paiement', 'code', 'libelle', '', 1); if (empty($arrayfields['b.num_chq']['checked'])) { - $labeltype .= ($objp->num_chq ? ' - '.$objp->num_chq : ''); + $labeltype .= ($objp->num_chq ? ' - '.$objp->num_chq.'' : ''); } print ''; if ($labeltype == 'SOLD') { print ' '; //$langs->trans("InitialBankBalance"); } else { - print dolPrintLabel($labeltype); + print dolPrintHtml($labeltype); } print "\n"; if (!$i) { diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b6184a532a3..41b70a4bf3e 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -61,6 +61,9 @@ * @var string $hidedetails * @var string $hidedesc * @var string $hideref + * @var ?string $confirm + * @var ?int $lineid + * @var ?int $id */ // $action or $cancel must be defined // $object must be defined diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6b05f8530a7..be8dc641f3a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -104,18 +104,18 @@ class Form /** * Output key field for an editable field * - * @param string $text Text of label or key to translate - * @param string $htmlname Name of select field ('edit' prefix will be added) - * @param string $preselected Value to show/edit (not used in this function) - * @param object $object Object (on the page we show) - * @param int<0,1> $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL. - * @param int<0,1> $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' - * @param string $paramid Key of parameter for id ('id', 'socid') - * @param string $help Tooltip help - * @return string HTML edit field + * @param string $text Text of label or key to translate + * @param string $htmlname Name of select field ('edit' prefix will be added) + * @param string $preselected Value to show/edit (not used in this function) + * @param object $object Object (on the page we show) + * @param int<0,1>|boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $moreparam More param to add on a href URL. + * @param int<0,1> $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' + * @param string $paramid Key of parameter for id ('id', 'socid') + * @param string $help Tooltip help + * @return string HTML edit field */ public function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id', $help = '') { @@ -125,7 +125,7 @@ class Form // TODO change for compatibility if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) { - if (!empty($perm)) { + if ($perm) { $tmp = explode(':', $typeofdata); $ret .= '
'; if ($fieldrequired) { diff --git a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php index e42300860a5..9ab6c30daab 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php @@ -115,7 +115,8 @@ class pdf_standard_evaluation extends ModelePDFEvaluation */ public function __construct($db) { - global $conf, $langs, $mysoc, $user; + global $langs, $mysoc; + // Translations $langs->loadLangs(array("main", "hrm")); @@ -305,6 +306,8 @@ class pdf_standard_evaluation extends ModelePDFEvaluation $iniY = $tab_top + 7; $nexY = $tab_top + 7; + $showmorebeforepagebreak = 0; + $pdf->setTopMargin($tab_top_newpage); // Loop on each lines $i = 0; @@ -324,10 +327,10 @@ class pdf_standard_evaluation extends ModelePDFEvaluation $curY = $nexY; $pdf->startTransaction(); + // Shod fields of line $this->printLine($pdf, $object, $i, $curY, $default_font_size, $outputlangs, $hidedetails); - $pageposafter = $pdf->getPage(); if ($pageposafter > $pageposbefore) { // There is a pagebreak @@ -495,39 +498,64 @@ class pdf_standard_evaluation extends ModelePDFEvaluation */ protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0) { - global $conf; $objectligne = $object->lines[$linenumber]; $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetTextColor(0, 0, 0); + // Rank of employee + $rankemptoshow = "-"; + if ($objectligne->rankorder > 0) { + $rankemptoshow = (string) $objectligne->rankorder; + } elseif ($objectligne->rankorder < 0) { + $rankemptoshow = $outputlangs->transnoentitiesnoconv("NA"); + } + $pdf->SetXY($this->posxrankemp, $curY); + $pdf->MultiCell($this->posxrequiredrank - $this->posxrankemp - 0.8, 4, $rankemptoshow, 0, 'C'); + + // Expected required Rank + $rankexpectedtoshow = "-"; + if ($objectligne->required_rank > 0) { + if ($objectligne->rankorder != 0) { + $rankexpectedtoshow = $objectligne->required_rank; + } + } elseif ($objectligne->required_rank < 0) { + $rankexpectedtoshow = $outputlangs->transnoentitiesnoconv("NA"); + } + $pdf->SetXY($this->posxrequiredrank, $curY); + $pdf->MultiCell($this->posxresult - $this->posxrequiredrank - 0.8, 4, $rankexpectedtoshow, 0, 'C'); + // Result $pdf->SetXY($this->posxresult - 1, $curY); - if ($objectligne->rankorder > $objectligne->required_rank) { + if ($objectligne->required_rank < 0) { // NA + $pdf->SetFillColor(255, 255, 255); + } elseif ($objectligne->rankorder > $objectligne->required_rank) { // Higher than expected // Teal Green - $pdf->SetFillColor(0, 109, 91); - } elseif ($objectligne->rankorder == $objectligne->required_rank) { + $pdf->SetFillColor(20, 129, 111); + } elseif ($objectligne->rankorder == $objectligne->required_rank) { // Same than expected // Seafoam Green - $pdf->SetFillColor(159, 226, 191); - } elseif ($objectligne->rankorder < $objectligne->required_rank) { - // red + $pdf->SetFillColor(169, 236, 201); + } elseif ($objectligne->rankorder < $objectligne->required_rank) { // Lower than expected + // Red $pdf->SetFillColor(205, 92, 92); } - if ($objectligne->rankorder == 0 || $objectligne->required_rank == 0) { + if ($objectligne->rankorder <= 0 || $objectligne->required_rank == 0) { // No fill color - $pdf->SetFillColor(255, 255, 255); + $pdf->SetFillColor(240, 240, 240); + } + $result = "-"; + if ($objectligne->required_rank < 0) { + if ($objectligne->rankorder > 0) { + $result = $objectligne->rankorder; + } + } elseif ($objectligne->rankorder < 0) { + $result = $outputlangs->transnoentitiesnoconv("NA"); + } elseif ($objectligne->required_rank != 0 && $objectligne->rankorder != 0) { + $result = $objectligne->rankorder . "/" . $objectligne->required_rank; } - $result = (($objectligne->required_rank != 0 && $objectligne->rankorder != 0) ? $objectligne->rankorder . "/" . $objectligne->required_rank : "-"); $pdf->MultiCell($this->posxresult - 210 - 0.8 - 4, 4, $result, 0, 'C', true); - - // required Rank - $pdf->SetXY($this->posxrequiredrank, $curY); - $pdf->MultiCell($this->posxresult - $this->posxrequiredrank - 0.8, 4, (($objectligne->required_rank != 0 && $objectligne->rankorder != 0) ? $objectligne->required_rank : "-"), 0, 'C'); - - // Rank Employee - $pdf->SetXY($this->posxrankemp, $curY); - $pdf->MultiCell($this->posxrequiredrank - $this->posxrankemp - 0.8, 4, (($objectligne->rankorder != 0) ? $objectligne->rankorder : "-"), 0, 'C'); + // The next fields can be on several lines so we output them at end so the pos on next line will work correctly // Skill $skill = new Skill($this->db); @@ -540,8 +568,6 @@ class pdf_standard_evaluation extends ModelePDFEvaluation } $pdf->writeHTMLCell($this->posxrankemp - $this->posxskill - 0.8, 4, $this->posxskill - 1, $curY, $comment, 0, 1); - - // Line num $pdf->SetXY($this->posxpiece, $curY); $pdf->writeHTMLCell($this->posxskill - $this->posxpiece - 0.8, 3, $this->posxpiece - 1, $curY, (string) ($linenumber + 1), 0, 1, false, false, 'C'); diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index bec9e3b5999..e47f788ca0e 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -197,7 +197,7 @@ class Skill extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -245,11 +245,8 @@ class Skill extends CommonObject */ public function create(User $user, $notrigger = 0) { - global $langs,$conf; - $resultcreate = $this->createCommon($user, $notrigger); - if ($resultcreate > 0) { // skillDet create $this->createSkills(); @@ -266,9 +263,9 @@ class Skill extends CommonObject */ public function createSkills($i = 1) { - global $conf, $user, $langs; + global $user, $langs; - $MaxNumberSkill = getDolGlobalInt('HRM_MAXRANK', self::DEFAULT_MAX_RANK_PER_SKILL); + $maxNumberSkill = getDolGlobalInt('HRM_MAXRANK', self::DEFAULT_MAX_RANK_PER_SKILL); $defaultSkillDesc = getDolGlobalString('HRM_DEFAULT_SKILL_DESCRIPTION', $langs->trans("NoDescription")); $error = 0; @@ -278,8 +275,9 @@ class Skill extends CommonObject $this->db->begin(); // Create level 0 of skills + /* Removed this. if a skill is not required for a job, the skill will just not be added to the job profile or will be added with expected level = N/A $skilldet = new Skilldet($this->db); - $skilldet->description = $langs->trans('SkillNotRequired'); + $skilldet->description = $langs->transnoentitiesnoconv('SkillNotRequired'); $skilldet->rankorder = 0; $skilldet->fk_skill = $this->id; @@ -287,15 +285,17 @@ class Skill extends CommonObject if ($result <= 0) { $error++; } + */ // Create level of skills - while ($i <= $MaxNumberSkill) { + while ($i <= $maxNumberSkill) { $skilldet = new Skilldet($this->db); $skilldet->description = $defaultSkillDesc . " " . $i; $skilldet->rankorder = $i; $skilldet->fk_skill = $this->id; $result = $skilldet->create($user); + if ($result <= 0) { $error++; } @@ -914,11 +914,13 @@ class Skill extends CommonObject */ public function LibStatut($status, $mode = 0) { + // phpcs:enable if (empty($status)) { $status = 0; } - // phpcs:enable + return ''; + /* if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; //$langs->load("hrm"); @@ -937,6 +939,7 @@ class Skill extends CommonObject } return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); + */ } /** diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index f42001024b5..f4d3e0bad91 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -179,7 +179,7 @@ class Skilldet extends CommonObjectLine */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -193,12 +193,6 @@ class Skilldet extends CommonObjectLine $this->fields['entity']['enabled'] = 0; } - // Example to show how to set values of fields definition dynamically - /*if ($user->rights->hrm->skilldet->read) { - $this->fields['myfield']['visible'] = 1; - $this->fields['myfield']['noteditable'] = 0; - }*/ - // Unset fields that are disabled foreach ($this->fields as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { @@ -243,7 +237,8 @@ class Skilldet extends CommonObjectLine */ public function createFromClone(User $user, $fromid) { - global $langs, $extrafields; + global $extrafields; + $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -481,7 +476,7 @@ class Skilldet extends CommonObjectLine */ public function validate($user, $notrigger = 0) { - global $conf, $langs; + global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -950,7 +945,7 @@ class Skilldet extends CommonObjectLine */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $langs; + global $langs; $result = 0; $includedocgeneration = 0; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 89913b05011..302a8f11a7b 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -138,6 +138,7 @@ if (empty($reshook)) { // action update on Skilldet must be done before real update action in core/actions_addupdatedelete.inc.php $skilldetArray = GETPOST("descriptionline", "array:alphanohtml"); + if (!$error) { if (is_array($skilldetArray) && count($skilldetArray) > 0) { if ($action == 'update' && $permissiontoadd) { @@ -171,6 +172,7 @@ if (empty($reshook)) { $arraySkill = $object->fetchLines(); '@phan-var-force Skilldet[] $arraySkill'; $index = 0; + foreach ($arraySkill as $skilldet) { if ($skilldet->rankorder != 0) { if (isset($skilldetArray[$index])) { @@ -377,11 +379,12 @@ if (($id || $ref) && $action == 'edit') { // $value = GETPOSTISSET($key) ? price2num(GETPOST($key, 'alphanohtml')) : $sk->$key; // } elseif (preg_match('/^(text|html)/', $val['type'])) { // $tmparray = explode(':', $val['type']); - if (!empty($tmparray[1])) { - $check = $tmparray[1]; - } else { - $check = 'restricthtml'; - } + //if (!empty($tmparray[1])) { + // $check = $tmparray[1]; + //} else { + // $check = 'restricthtml'; + //} + $check = 'restricthtml'; $skilldetArray = GETPOST("descriptionline", "array"); if (empty($skilldetArray)) { diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index dfae51fd352..1c7744380d3 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -687,3 +687,5 @@ ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE INDEX uk_pr -- delete a constant that should not be set DELETE FROM llx_const WHERE name = 'INVOICE_USE_RETAINED_WARRANTY' AND value = -1; + +DELETE FROM llx_hrm_skilldet WHERE rankorder = 0; diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 2b19ff477ea..3e0790f2593 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -147,3 +147,4 @@ ConfirmUserClone=Are you sure you want to clone the user: %s? NewEmailUserClone=Email address of the new user SocialNetworksUser=Social networks for user MyTeam=My team +TotalAPICall=Total API Calls diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index db3b81ba061..3f527c3e311 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,19 +146,20 @@ class Salary extends CommonObject public $user; /** - * @var int<0,1> 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) - * @deprecated Use $status and $close_code + * @var int<0,1> 1 if salary paid COMPLETELY, 0 otherwise (Note ->paye is still used for salary, the couple statut/close_code that replace it is for invoices only) */ public $paye; - const STATUS_UNPAID = 0; - const STATUS_PAID = 1; - /** * @var float amount remain to pay */ public $resteapayer; + + const STATUS_UNPAID = 0; + const STATUS_PAID = 1; + + public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'visible' => 1, 'index' => 1, 'comment' => "Reference of object"), diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7c966681660..301b40831aa 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -319,8 +319,9 @@ a.commonlink { color: var(--colortextlink) !important; text-decoration: none; } th.liste_titre a div div:hover, th.liste_titre_sel a div div:hover { text-decoration: underline; } tr.liste_titre th.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre td.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titre:not(.maxwidthsearch) { opacity: 0.8; } -/* th.liste_titre_sel a, th.liste_titre a, td.liste_titre_sel a, td.liste_titre a { color: #766; } */ -tr.liste_titre_filter th.liste_titre:not(.center) { text-align: unset; } +tr.liste_titre_filter th.liste_titre:not(.center), tr.liste_titre_filter th.liste_titre_sel:not(.center) { + text-align: unset; +} .liste_titre.trheight5em { height: 4em !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c74911171d8..19dd1677727 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5038,10 +5038,11 @@ tr.liste_titre_topborder td { background: transparent; } tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_titre_sel, tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */ - /* border-bottom: 1px solid var(--colortopbordertitle1); */ border-bottom: none; } -tr.liste_titre_filter th.liste_titre:not(.center) { text-align: unset; } +tr.liste_titre_filter th.liste_titre:not(.center), tr.liste_titre_filter th.liste_titre_sel:not(.center) { + text-align: unset; +} /* div.liste_titre { diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index df9eff246f4..66d34c04b99 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -63,16 +63,6 @@ if (isModEnabled('accounting')) { * @var User $user */ -// $moreparam is used, but it is unclear how it is set, keeping the variable and ensuring it exists. -// $countrynotdefined is used, but it is unclear how it is set. -' -@phan-var-force ?string $moreparam -@phan-var-force ?string $countrynotdefined -'; -if (!isset($moreparam)) { - $moreparam = null; -} - // Load translation files required by page $langs->loadLangs(array('accountancy', 'companies', 'commercial', 'banks', 'bills', 'trips', 'holiday', 'salaries')); @@ -228,8 +218,8 @@ if ($action == 'delete_confirmed' && !$cancel && $permissiontoaddbankaccount) { $action = ''; } -// update birth -if ($action == 'setbirth' && $usercanadd && !$cancel) { +// update birth (pure personal information) +if ($action == 'setbirth' && $permissiontowritehr && !$cancel) { $object->birth = dol_mktime(0, 0, 0, GETPOSTINT('birthmonth'), GETPOSTINT('birthday'), GETPOSTINT('birthyear')); $result = $object->update($user); if ($result < 0) { @@ -283,8 +273,8 @@ if ($action == 'setref_employee' && $usercanadd && !$cancel) { } } -// update national_registration_number -if ($action == 'setnational_registration_number' && $usercanadd && !$cancel) { +// update national_registration_number (pure personal information) +if ($action == 'setnational_registration_number' && $permissiontowritehr && !$cancel) { $object->national_registration_number = (string) GETPOST('national_registration_number', 'alphanohtml'); $result = $object->update($user); if ($result < 0) { @@ -526,8 +516,8 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; print "\n"; - // Date of birth - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) { + // Date of birth (pure personal information) + if ($permissiontoreadhr) { print ''; print ''; print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->hasRight('user', 'user', 'creer')); @@ -538,23 +528,23 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Personal email - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($permissiontoreadhr || $permissiontosimpleedit) { print ''; print ''; - print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, (int) ($user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'))); + print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr); print ''; - print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'email', '', null, null, '', 0, ''); + print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr, 'email', '', null, null, '', 0, ''); print ''; print ''; } // Personal phone - if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write') || $permissiontosimpleedit) { + if ($permissiontoreadhr || $permissiontosimpleedit) { print ''; print ''; - print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, (int) ($user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'))); + print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr); print ''; - print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'phone', '', null, null, '', 0, ''); + print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $permissiontowritehr, 'phone', '', null, null, '', 0, ''); print ''; print ''; } @@ -565,7 +555,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print $form->editfieldkey("DefaultCategoryCar", 'default_c_exp_tax_cat', (string) $object->default_c_exp_tax_cat, $object, $user->hasRight('user', 'user', 'creer')); print ''; if ($action == 'editdefault_c_exp_tax_cat') { - $ret = '
'; + $ret = ''; $ret .= ''; $ret .= ''; $ret .= ''; @@ -587,7 +577,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print $form->editfieldkey("DefaultRangeNumber", 'default_range', (string) $object->default_range, $object, $user->hasRight('user', 'user', 'creer')); print ''; if ($action == 'editdefault_range') { - $ret = ''; + $ret = ''; $ret .= ''; $ret .= ''; $ret .= ''; @@ -608,17 +598,17 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Employee Number - if ($permissiontoreadhr) { + if ($permissiontoreadhr || $permissiontosimpleedit) { print ''; print ''; - print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr); + print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr || $permissiontosimpleedit); print ''; - print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr, 'string', $object->ref_employee); + print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $permissiontowritehr || $permissiontosimpleedit, 'string', $object->ref_employee); print ''; print ''; } - // National registration number + // National registration number (pure personal information) if ($permissiontoreadhr) { print ''; print ''; @@ -732,7 +722,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $db->free($resql); if ($num <= 0) { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ""; print "
"; @@ -1023,8 +1013,6 @@ if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankacc if ($selectedcode) { print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id'); - } else { - print $countrynotdefined; } print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index daf327223a2..d45b26f5a9e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2061,6 +2061,11 @@ if ($action == 'create' || $action == 'adduserldap') { print showValueWithClipboardCPButton($object->api_key, 1, $langs->transnoentities("Hidden")); // TODO Add an option to also reveal the hash, not only copy paste print ''; } + + if (getDolGlobalString('API_ENABLE_COUNT_CALLS')) { + print '   '.getDolUserInt('API_COUNT_CALL').''; + } + print ''; } if ((getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 0) || (getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 1 && $object->id == $user->id)) { diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 8c7a4d1b5fb..e09c3614a72 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -371,25 +371,23 @@ $totalarray['nbfield'] = 0; print ''; // Action column if ($conf->main_checkbox_left_column) { - print ''; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder); +print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", '', $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; //multicompany if (isModEnabled('multicompany') && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { - print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } -print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; -print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; -print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; -print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", '', $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -403,7 +401,7 @@ print $hookmanager->resPrint; }*/ // Action column if (!$conf->main_checkbox_left_column) { - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 715a95ce0f1..da6c1e2897b 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -54,6 +54,7 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $module = GETPOST('module', 'alpha'); $rights = GETPOSTINT('rights'); +$updatedmodulename = GETPOST('updatedmodulename', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'groupperms'; // To manage different context of search if (!isset($id) || empty($id)) { @@ -224,6 +225,7 @@ if ($object->id > 0) { dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin); + print '
'; print '
'; @@ -264,6 +266,7 @@ if ($object->id > 0) { print '
'; + if ($user->admin) { print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); print '
'; @@ -282,16 +285,14 @@ if ($object->id > 0) { print ''.$langs->trans("Module").''; if ($permissiontoedit) { print ''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print '/'; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''; } else { print ''; } print ''; - //print ''.$langs->trans("Permissions").''; - print ''; print ''.img_picto('', 'folder-open', 'class="paddingright"').''.$langs->trans("ExpandAll").''; print ' | '; @@ -304,7 +305,7 @@ if ($object->id > 0) { $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql .= " AND r.entity = ".((int) $entity); if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable + $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled } $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; @@ -407,10 +408,12 @@ if ($object->id > 0) { if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Own permission by group if ($permissiontoedit) { - print 'id.'&confirm=yes">'; + print ''; + print 'id.'&confirm=yes&updatedmodulename='.$obj->module.'">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); - print ''; + print ''; + print ''; } print ''; print img_picto($langs->trans("Active"), 'tick'); @@ -418,17 +421,20 @@ if ($object->id > 0) { } else { // Do not own permission if ($permissiontoedit) { - print 'id.'&confirm=yes">'; + print ''; + print 'id.'&confirm=yes&updatedmodulename='.$obj->module.'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); - print ''; + print ''; + print ''; } print ''; } } else { // Do not own permission if ($permissiontoedit) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print ''; + print 'id.'&confirm=yes&updatedmodulename='.$obj->module.'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; @@ -438,7 +444,7 @@ if ($object->id > 0) { print ''; } - // Description of permission (2 columns) + // Description of permission (1 column) print ''; print $permlabel; $idtouse = $obj->id; @@ -462,8 +468,8 @@ if ($object->id > 0) { if ($user->admin) { print ''; $htmltext = $langs->trans("ID").': '.$obj->id; - $htmltext .= '
'.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')'; - print $form->textwithpicto('', $htmltext, 1, 'help', 'marginrightonly'); + $htmltext .= '
'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')'; + print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly'); //print ''.$obj->id.''; print ''; } else { @@ -484,15 +490,15 @@ if ($object->id > 0) { moduletohide = $(this).data("hide-perms"); j = $(this).data("j"); if ($("#idforbreakperms_"+moduletohide).val() == 1) { - console.log("idforbreakperms_"+moduletohide+" has value hidden=1"); + console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines"); $(".trtohide_"+moduletohide).show(); $(".permtoshow_"+moduletohide).hide(); $(".permtohide_"+moduletohide).show(); $(".folderperms_"+moduletohide).hide(); $(".folderopenperms_"+moduletohide).show(); $("#idforbreakperms_"+moduletohide).val("0"); - } else { - console.log("idforbreakperms_"+moduletohide+" has value hidden=0"); + } else if (! $(this).hasClass("tdforbreakpermsifnotempty")) { + console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines"); $(".trtohide_"+moduletohide).hide(); $(".folderopenperms_"+moduletohide).hide(); $(".folderperms_"+moduletohide).show(); @@ -519,6 +525,7 @@ if ($object->id > 0) { document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ "; } });'; + print "\n"; // Button expand / collapse all print '$(".showallperms").on("click", function(){ @@ -554,7 +561,6 @@ if ($object->id > 0) { cursor: pointer; }'; print ''; - print '
'; $parameters = array(); $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index f458bf23665..d52e7b2307e 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -332,6 +332,7 @@ print ''; print ''; print '
'; + if ($user->admin) { print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); } @@ -347,9 +348,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -//$listofexpandedmodules = array(); - - print "\n"; print '
'; print ''; @@ -366,7 +364,6 @@ if ($caneditperms) { print ''; } print ''; -//print ''; print '
'; print ''.img_picto('', 'folder-open', 'class="paddingright"').''.$langs->trans("ExpandAll").''; print ' | '; @@ -632,7 +629,7 @@ if ($result) { // Do not own permission if ($caneditperms) { print ''; - print 'id.'&confirm=yes&token='.newToken().'&updatedmodulename='.$obj->module.'">'; + print 'id.'&confirm=yes&updatedmodulename='.$obj->module.'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; @@ -650,7 +647,7 @@ if ($result) { print ''; if ($caneditperms) { print ''; - print 'id.'&confirm=yes&token='.newToken().'&updatedmodulename='.$obj->module.'">'; + print 'id.'&confirm=yes&updatedmodulename='.$obj->module.'">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print '';