diff --git a/ChangeLog.md b/ChangeLog.md index eb160d1..50d2d83 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,6 +3,7 @@ ## Unreleased ## 1.1 +- NEW : Compat v23 - *18/12/2025* - 1.1.1 - NEW : Compat v22 - *23/07/2025* - 1.1.0 ## 1.0 @@ -13,5 +14,3 @@ - FIX : REF on create notation - *07/04/2023* - 1.0.1 Initial version - - diff --git a/core/modules/modNotation.class.php b/core/modules/modNotation.class.php index c0dbdef..a7b8053 100644 --- a/core/modules/modNotation.class.php +++ b/core/modules/modNotation.class.php @@ -175,13 +175,13 @@ public function __construct($db) // Array to add new pages in new tabs $this->tabs = array(); // ligne vers session tab - $this->tabs[] = array('data' => 'agefodd_session:+notation:Notation:notation@notation:$user->rights->notation->notationnote->read:/notation/notationnote_list.php?session=__ID__'); + $this->tabs[] = array('data' => "agefodd_session:+notation:Notation:notation@notation:$user->hasRight('notation', 'notationnote', 'read'):/notation/notationnote_list.php?session=__ID__"); // ligne vers formation tab - $this->tabs[] = array('data' => 'agefodd_training:+notation:Notation:notation@notation:$user->rights->notation->notationnote->read:/notation/notationnote_list.php?formation=__ID__'); + $this->tabs[] = array('data' => "agefodd_training:+notation:Notation:notation@notation:$user->hasRight('notation', 'notationnote', 'read'):/notation/notationnote_list.php?formation=__ID__"); // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@notation:$user->rights->notation->read:/notation/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@notation:$user->rights->othermodule->read:/notation/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@notation:$user->hasRight('notation', 'read'):/notation/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@notation:$user->hasRight('othermodule', 'read'):/notation/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // // Where objecttype can be @@ -278,7 +278,7 @@ public function __construct($db) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->hasRight("notation", "notationnote", "read")) $r++; $this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used) - $this->rights[$r][1] = $langs->trans('CreateUpdateObj') ; // Permission label + $this->rights[$r][1] = $langs->trans('CreateUpdateObj'); // Permission label $this->rights[$r][4] = 'notationnote'; $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->hasRight("notation", "notationnote", "write")) $r++; @@ -311,47 +311,46 @@ public function __construct($db) );*/ - /* $this->menu[$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=notation', - // This is a Left menu entry - 'type'=>'left', - 'titre'=>'List NotationNote', - 'mainmenu'=>'notation', - 'leftmenu'=>'notation_notationnote', - 'url'=>'/notation/notationnote_list.php', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'notation@notation', - 'position'=>1100+$r, - // Define condition to show or hide menu entry. Use '$conf->notation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'isModEnabled("notation")', - // Use 'perms'=>'$user->hasRight("notation", "level1", "level2")' if you want your menu with a permission rules - 'perms'=>'1', - 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, - ); - $this->menu[$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=notation,fk_leftmenu=notation_notationnote', - // This is a Left menu entry - 'type'=>'left', - 'titre'=>'New NotationNote', - 'mainmenu'=>'notation', - 'leftmenu'=>'notation_notationnote', - 'url'=>'/notation/notationnote_card.php?action=create', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'notation@notation', - 'position'=>1100+$r, - // Define condition to show or hide menu entry. Use '$conf->notation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'isModEnabled("notation")', - // Use 'perms'=>'$user->hasRight("notation", "level1", "level2")' if you want your menu with a permission rules - 'perms'=>'1', - 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 - );*/ - + /* $this->menu[$r++]=array( + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu'=>'fk_mainmenu=notation', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'List NotationNote', + 'mainmenu'=>'notation', + 'leftmenu'=>'notation_notationnote', + 'url'=>'/notation/notationnote_list.php', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'notation@notation', + 'position'=>1100+$r, + // Define condition to show or hide menu entry. Use '$conf->notation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'isModEnabled("notation")', + // Use 'perms'=>'$user->hasRight("notation", "level1", "level2")' if you want your menu with a permission rules + 'perms'=>'1', + 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both + 'user'=>2, + ); + $this->menu[$r++]=array( + // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'fk_menu'=>'fk_mainmenu=notation,fk_leftmenu=notation_notationnote', + // This is a Left menu entry + 'type'=>'left', + 'titre'=>'New NotationNote', + 'mainmenu'=>'notation', + 'leftmenu'=>'notation_notationnote', + 'url'=>'/notation/notationnote_card.php?action=create', + // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'langs'=>'notation@notation', + 'position'=>1100+$r, + // Define condition to show or hide menu entry. Use '$conf->notation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled'=>'isModEnabled("notation")', + // Use 'perms'=>'$user->hasRight("notation", "level1", "level2")' if you want your menu with a permission rules + 'perms'=>'1', + 'target'=>'', + // 0=Menu for internal users, 1=external users, 2=both + 'user'=>2 + );*/ } /** diff --git a/notationnote_card.php b/notationnote_card.php index 5fce4e0..0ca55c6 100644 --- a/notationnote_card.php +++ b/notationnote_card.php @@ -102,9 +102,9 @@ $session = GETPOST('session', 'int'); $fk_session = GETPOST('fk_session', 'int'); $formation = GETPOST('formation', 'int'); -$note = GETPOST('note','int'); +$note = GETPOST('note', 'int'); $fk_trainee = GETPOST('fk_trainee', 'int'); -$status=GETPOST('status','int'); +$status=GETPOST('status', 'int'); // Initialize technical objects @@ -140,7 +140,7 @@ if ($enablepermissioncheck) { $permissiontoread = $user->hasRight("notation", "notationnote", "read"); $permissiontoadd = $user->hasRight("notation", "notationnote", "write"); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php - $permissiontodelete = $user->rights->notation->notationnote->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + $permissiontodelete = $user->hasRight('notation', 'notationnote', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissionnote = $user->hasRight("notation", "notationnote", "write"); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight("notation", "notationnote", "write"); // Used by the include of actions_dellink.inc.php } else { @@ -183,17 +183,14 @@ } // Error handler - if (($action == 'add' || $action == 'update') && empty($cancel)){ - - + if (($action == 'add' || $action == 'update') && empty($cancel)) { if (empty($object->ref) && $action == "add") $object->ref = $object->getNextNumRef(); $error=0; - if (empty(GETPOST('note')) || GETPOST('note') < floatval(getDolGlobalString('MIN_NOTATION', '0')) || GETPOST('note') > floatval(getDolGlobalString('MAX_NOTATION', '0')) ){ + if (empty(GETPOST('note')) || GETPOST('note') < floatval(getDolGlobalString('MIN_NOTATION', '0')) || GETPOST('note') > floatval(getDolGlobalString('MAX_NOTATION', '0')) ) { setEventMessages($langs->trans('ErrorType', $langs->transnoentitiesnoconv($object->fields['note']['label'])), null, 'errors'); $error++; } - } @@ -252,9 +249,9 @@ $help_url = ''; llxHeader('', $title, $help_url); -if (!empty($formation)){ +if (!empty($formation)) { $addparams = "&formation=".$formation; -}else{ +} else { $addparams = "&session=".$session; } @@ -270,10 +267,10 @@ $res = $agf->fetch($session); $agf->fetch_societe_per_session($session); - $ref = $agf->getNomUrl(1,"",0,'ref'); + $ref = $agf->getNomUrl(1, "", 0, 'ref'); -// Display consult + // Display consult $head = session_prepare_head($agf); dol_fiche_head($head, 'notation', $langs->trans('AgfSessionDetail'), -1, 'generic'); @@ -325,7 +322,6 @@ // Part to edit record if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("NotationNote"), '', 'object_'.$object->picto); print '