2005-04-13 12:04:02 +00:00
< ? php
2024-07-10 16:59:04 +00:00
/* Copyright ( C ) 2005 Matthieu Valleton < mv @ seeschloss . org >
2024-09-06 14:40:06 +00:00
* Copyright ( C ) 2006 - 2024 Laurent Destailleur < eldy @ users . sourceforge . net >
2024-07-10 16:59:04 +00:00
* Copyright ( C ) 2007 Patrick Raguin < patrick . raguin @ gmail . com >
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ inodbox . com >
* Copyright ( C ) 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
* Copyright ( C ) 2020 Tobias Sekan < tobias . sekan @ startmail . com >
* Copyright ( C ) 2020 Josep Lluís Amador < joseplluis @ lliuretic . cat >
2025-02-27 05:51:00 +00:00
* Copyright ( C ) 2022 - 2023 Solution Libre SAS < contact @ solution - libre . fr >
2025-03-16 19:45:04 +00:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2026-04-20 20:11:20 +00:00
* Copyright ( C ) 2024 - 2026 Frédéric France < frederic . france @ free . fr >
2025-03-02 21:10:46 +00:00
* Copyright ( C ) 2024 - 2025 Alexandre Spangaro < alexandre @ inovea - conseil . com >
2024-11-15 13:09:04 +00:00
* Copyright ( C ) 2023 - 2024 Charlene Benke < charlene @ patas - monkey . com >
2005-04-13 12:04:02 +00:00
*
* 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
2013-01-16 14:36:08 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2005-04-13 12:04:02 +00:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2005-04-13 12:04:02 +00:00
*/
2006-08-15 18:52:02 +00:00
/**
2009-07-22 17:02:49 +00:00
* \file htdocs / categories / viewcat . php
* \ingroup category
2010-03-20 00:07:47 +00:00
* \brief Page to show a category card
2009-07-22 17:02:49 +00:00
*/
2006-08-15 18:52:02 +00:00
2022-09-07 18:08:59 +00:00
// Load Dolibarr environment
2012-08-22 21:24:21 +00:00
require '../main.inc.php' ;
2024-11-04 22:53:20 +00:00
/**
* @ var Conf $conf
* @ var DoliDB $db
2026-04-20 20:11:20 +00:00
* @ var ExtraFields $extrafields
2024-11-04 22:53:20 +00:00
* @ var HookManager $hookmanager
* @ var Translate $langs
* @ var User $user
*/
2025-12-20 12:53:43 +00:00
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/categories.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2024-11-04 22:53:20 +00:00
2018-05-27 07:58:23 +00:00
// Load translation files required by the page
2026-03-16 19:43:16 +00:00
$langs -> loadLangs ( array ( " categories " , " compta " , " mrp " , " stocks " ));
2011-03-14 11:21:46 +00:00
2023-12-04 11:01:45 +00:00
$action = GETPOST ( 'action' , 'aZ09' ) ? GETPOST ( 'action' , 'aZ09' ) : 'view' ; // The action 'add', 'create', 'edit', 'update', 'view', ...
2019-11-13 18:35:39 +00:00
$massaction = GETPOST ( 'massaction' , 'alpha' ); // The bulk action (combo box choice into lists)
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$show_files = GETPOSTINT ( 'show_files' ); // Show files area generated by bulk actions ?
2019-11-13 18:35:39 +00:00
$confirm = GETPOST ( 'confirm' , 'alpha' ); // Result of a confirmation
$cancel = GETPOST ( 'cancel' , 'alpha' ); // We click on a Cancel button
2025-09-18 09:40:56 +00:00
$toselect = GETPOST ( 'toselect' , 'array:int' ); // Array of ids of elements selected into a list
2023-12-04 11:01:45 +00:00
$contextpage = GETPOST ( 'contextpage' , 'aZ' ) ? GETPOST ( 'contextpage' , 'aZ' ) : 'categorylist' ; // To manage different context of search
2019-11-13 18:35:39 +00:00
$backtopage = GETPOST ( 'backtopage' , 'alpha' ); // Go back to a dedicated page
2021-02-23 17:04:37 +00:00
$optioncss = GETPOST ( 'optioncss' , 'aZ' ); // Option for the css output (always '' except when 'print')
2019-09-09 23:44:36 +00:00
2024-11-08 09:08:06 +00:00
$id = GETPOSTINT ( 'id' );
$label = GETPOST ( 'label' , 'alpha' );
$removeelem = GETPOSTINT ( 'removeelem' );
$elemid = GETPOSTINT ( 'elemid' );
if ( GETPOST ( 'addintocategory' )) {
$action = 'addintocategory' ;
}
2020-09-23 14:36:19 +00:00
2019-09-09 23:44:36 +00:00
// Load variable for pagination
2024-03-16 10:41:00 +00:00
$limit = GETPOSTINT ( 'limit' ) ? GETPOSTINT ( 'limit' ) : $conf -> liste_limit ;
2020-09-18 15:13:01 +00:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
2020-09-17 12:31:25 +00:00
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2024-03-01 00:52:40 +00:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOSTINT ( 'pageplusone' ) - 1 ) : GETPOSTINT ( " page " );
2021-02-23 17:04:37 +00:00
if ( empty ( $page ) || $page == - 1 || GETPOST ( 'button_search' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' ) || ( empty ( $toselect ) && $massaction === '0' )) {
$page = 0 ;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
2019-09-09 23:44:36 +00:00
$offset = $limit * $page ;
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2021-02-23 17:04:37 +00:00
if ( $id == " " && $label == " " ) {
2024-01-20 08:22:38 +00:00
dol_print_error ( null , 'Missing parameter id' );
2009-11-04 19:13:37 +00:00
exit ();
2006-03-30 15:02:24 +00:00
}
2024-08-20 21:32:43 +00:00
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager -> initHooks ( array ( 'categorycard' , 'globalcard' ));
2011-03-11 14:59:35 +00:00
$object = new Categorie ( $db );
2020-11-21 12:28:37 +00:00
$result = $object -> fetch ( $id , $label );
2018-02-21 13:48:25 +00:00
if ( $result <= 0 ) {
2023-12-04 11:01:45 +00:00
dol_print_error ( $db , $object -> error );
exit ;
2018-02-21 13:48:25 +00:00
}
2007-02-22 20:59:41 +00:00
2025-10-24 16:22:30 +00:00
// Security check
$result = restrictedArea ( $user , 'categorie' , $object -> id , '&category' );
2020-11-21 12:28:37 +00:00
$type = $object -> type ;
2021-02-23 17:04:37 +00:00
if ( is_numeric ( $type )) {
2025-02-23 18:42:49 +00:00
$type = array_search ( $type , $object -> MAP_ID ); // For backward compatibility
2021-02-23 17:04:37 +00:00
}
2007-02-22 20:59:41 +00:00
2019-10-06 12:41:52 +00:00
$extrafields -> fetch_name_optionals_label ( $object -> table_element );
2007-02-22 20:59:41 +00:00
/*
2009-07-22 17:02:49 +00:00
* Actions
*/
2020-11-23 18:53:58 +00:00
2021-02-23 17:04:37 +00:00
if ( $confirm == 'no' ) {
2020-11-21 21:40:31 +00:00
if ( $backtopage ) {
header ( " Location: " . $backtopage );
exit ;
}
}
2024-03-14 17:40:56 +00:00
$parameters = array ( 'type' => $type , 'id' => $id , 'label' => $label );
2019-11-13 18:35:39 +00:00
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2013-06-05 14:24:32 +00:00
// Remove element from category
2024-09-06 14:40:06 +00:00
if ( $id > 0 && $removeelem > 0 && $action == 'unlink' ) { // Test on permission not required here. Done later according to type of object.
2024-09-18 01:27:25 +00:00
$tmpobject = null ;
2024-11-15 13:09:04 +00:00
$elementtype = '' ;
2023-06-19 21:05:59 +00:00
if ( $type == Categorie :: TYPE_PRODUCT && ( $user -> hasRight ( 'produit' , 'creer' ) || $user -> hasRight ( 'service' , 'creer' ))) {
2013-06-05 14:24:32 +00:00
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
$tmpobject = new Product ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'product' ;
2023-06-05 21:49:13 +00:00
} elseif ( $type == Categorie :: TYPE_SUPPLIER && $user -> hasRight ( 'societe' , 'creer' )) {
2013-06-05 14:24:32 +00:00
$tmpobject = new Societe ( $db );
$result = $tmpobject -> fetch ( $removeelem );
2017-11-03 16:29:25 +00:00
$elementtype = 'supplier' ;
2023-06-05 21:49:13 +00:00
} elseif ( $type == Categorie :: TYPE_CUSTOMER && $user -> hasRight ( 'societe' , 'creer' )) {
2013-06-05 14:24:32 +00:00
$tmpobject = new Societe ( $db );
$result = $tmpobject -> fetch ( $removeelem );
2017-11-03 16:29:25 +00:00
$elementtype = 'customer' ;
2022-09-09 08:29:27 +00:00
} elseif ( $type == Categorie :: TYPE_MEMBER && $user -> hasRight ( 'adherent' , 'creer' )) {
2013-06-05 14:24:32 +00:00
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
$tmpobject = new Adherent ( $db );
$result = $tmpobject -> fetch ( $removeelem );
2013-04-21 21:44:33 +00:00
$elementtype = 'member' ;
2023-06-05 21:49:13 +00:00
} elseif ( $type == Categorie :: TYPE_CONTACT && $user -> hasRight ( 'societe' , 'creer' )) {
2013-07-30 15:28:08 +00:00
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
$tmpobject = new Contact ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'contact' ;
2023-10-15 13:32:35 +00:00
} elseif ( $type == Categorie :: TYPE_ACCOUNT && $user -> hasRight ( 'banque' , 'configurer' )) {
2020-10-31 13:32:18 +00:00
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
$tmpobject = new Account ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'account' ;
2023-10-15 13:32:35 +00:00
} elseif ( $type == Categorie :: TYPE_PROJECT && $user -> hasRight ( 'projet' , 'creer' )) {
2020-10-31 13:32:18 +00:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
$tmpobject = new Project ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'project' ;
2023-06-05 21:49:13 +00:00
} elseif ( $type == Categorie :: TYPE_USER && $user -> hasRight ( 'user' , 'user' , 'creer' )) {
2020-02-03 10:01:58 +00:00
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
$tmpobject = new User ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'user' ;
2023-10-15 13:32:35 +00:00
} elseif ( $type == Categorie :: TYPE_TICKET && $user -> hasRight ( 'ticket' , 'write' )) {
2021-07-01 17:30:00 +00:00
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php' ;
$tmpobject = new Ticket ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'ticket' ;
2024-11-15 13:09:04 +00:00
} elseif ( $type == Categorie :: TYPE_FICHINTER && $user -> hasRight ( 'ficheinter' , 'write' )) {
require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php' ;
$tmpobject = new Fichinter ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'fichinter' ;
2025-02-14 13:29:49 +00:00
} elseif ( $type == Categorie :: TYPE_ORDER && $user -> hasRight ( 'commande' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
$tmpobject = new Commande ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'order' ;
2026-01-07 10:23:20 +00:00
} elseif ( $type == Categorie :: TYPE_MO && $user -> hasRight ( 'mrp' , 'write' )) {
require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php' ;
$tmpobject = new Mo ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'mo' ;
2025-02-27 05:51:00 +00:00
} elseif ( $type == Categorie :: TYPE_INVOICE && $user -> hasRight ( 'facture' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
$tmpobject = new Facture ( $db );
$result = $tmpobject -> fetch ( $removeelem );
$elementtype = 'invoice' ;
2025-03-11 02:20:26 +00:00
} elseif ( $type == Categorie :: TYPE_SUPPLIER_ORDER && $user -> hasRight ( 'fournisseur' , 'commande' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php' ;
$tmpobject = new CommandeFournisseur ( $db );
$result = $tmpobject -> fetch ( $removeelem );
2025-03-11 16:23:33 +00:00
$elementtype = 'supplier_order' ;
2024-11-15 13:09:04 +00:00
} else {
dol_print_error ( null , " Not supported value of type = " . $type );
2025-03-16 19:45:04 +00:00
$result = - 100 ;
2020-02-03 10:01:58 +00:00
}
2014-01-12 14:54:28 +00:00
2025-03-16 19:45:04 +00:00
if ( $tmpobject !== null ) {
// also enter here when item was not found to report error
$result = $object -> del_type ( $tmpobject , $elementtype );
if ( $result < 0 ) {
dol_print_error ( null , $object -> error );
}
2021-02-23 17:04:37 +00:00
}
2013-06-05 14:24:32 +00:00
}
2013-04-21 21:44:33 +00:00
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'categorie' , 'supprimer' ) && $action == 'confirm_delete' && $confirm == 'yes' ) {
2021-02-23 17:04:37 +00:00
if ( $object -> delete ( $user ) >= 0 ) {
2020-11-21 21:40:31 +00:00
if ( $backtopage ) {
header ( " Location: " . $backtopage );
exit ;
} else {
2025-10-17 00:31:07 +00:00
header ( " Location: " . dolBuildUrl ( DOL_URL_ROOT . '/categories/categorie_list.php' , [ 'type' => $type ]));
2020-11-21 21:40:31 +00:00
exit ;
}
2020-05-21 13:05:19 +00:00
} else {
2015-11-06 08:36:16 +00:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
2007-02-22 20:59:41 +00:00
}
2005-04-13 12:04:02 +00:00
}
2024-09-06 14:40:06 +00:00
if ( $elemid && $action == 'addintocategory' ) { // Test on permission not required here. Done just after depending on object type
2024-11-15 13:09:04 +00:00
$newobject = null ;
$elementtype = '' ;
if ( $type == Categorie :: TYPE_PRODUCT && ( $user -> hasRight ( 'produit' , 'creer' ) || $user -> hasRight ( 'service' , 'creer' ))) {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
$newobject = new Product ( $db );
$elementtype = 'product' ;
} elseif ( $type == Categorie :: TYPE_CUSTOMER && $user -> hasRight ( 'societe' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
$newobject = new Societe ( $db );
$elementtype = 'customer' ;
} elseif ( $type == Categorie :: TYPE_SUPPLIER && $user -> hasRight ( 'societe' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
$newobject = new Societe ( $db );
$elementtype = 'supplier' ;
} elseif ( $type == Categorie :: TYPE_TICKET && $user -> hasRight ( 'ticket' , 'write' )) {
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php' ;
$newobject = new Ticket ( $db );
$elementtype = 'ticket' ;
} elseif ( $type == Categorie :: TYPE_FICHINTER && $user -> hasRight ( 'ficheinter' , 'write' )) {
require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php' ;
$newobject = new Fichinter ( $db );
$elementtype = 'fichinter' ;
} elseif ( $type == Categorie :: TYPE_PROJECT && $user -> hasRight ( 'projet' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
$newobject = new Project ( $db );
$elementtype = 'project' ;
} elseif ( $type == Categorie :: TYPE_MEMBER && $user -> hasRight ( 'adherent' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
$newobject = new Adherent ( $db );
$elementtype = 'member' ;
} elseif ( $type == Categorie :: TYPE_CONTACT && $user -> hasRight ( 'societe' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
$newobject = new Contact ( $db );
$elementtype = 'contact' ;
} elseif ( $type == Categorie :: TYPE_USER && $user -> hasRight ( 'user' , 'user' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
$newobject = new User ( $db );
$elementtype = 'user' ;
} elseif ( $type == Categorie :: TYPE_ACCOUNT && $user -> hasRight ( 'banque' , 'configurer' )) {
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
$newobject = new Account ( $db );
$elementtype = 'bank_account' ;
2025-02-14 13:29:49 +00:00
} elseif ( $type == Categorie :: TYPE_ORDER && $user -> hasRight ( 'commande' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
$newobject = new Commande ( $db );
$elementtype = 'order' ;
2026-01-07 10:23:20 +00:00
} elseif ( $type == Categorie :: TYPE_MO && $user -> hasRight ( 'mrp' , 'write' )) {
require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php' ;
$newobject = new Mo ( $db );
$elementtype = 'mo' ;
2025-02-27 05:51:00 +00:00
} elseif ( $type == Categorie :: TYPE_INVOICE && $user -> hasRight ( 'facture' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
$newobject = new Facture ( $db );
2025-03-02 21:10:46 +00:00
$elementtype = 'invoice' ;
2025-03-11 02:20:26 +00:00
} elseif ( $type == Categorie :: TYPE_SUPPLIER_ORDER && $user -> hasRight ( 'fournisseur' , 'commande' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php' ;
$newobject = new CommandeFournisseur ( $db );
2025-03-11 16:23:33 +00:00
$elementtype = 'supplier_order' ;
2025-03-25 15:28:51 +00:00
} elseif ( $type == Categorie :: TYPE_SUPPLIER_INVOICE && $user -> hasRight ( 'fournisseur' , 'facture' , 'creer' )) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php' ;
$newobject = new FactureFournisseur ( $db );
$elementtype = 'supplier_invoice' ;
2024-11-15 13:09:04 +00:00
} else {
dol_print_error ( null , " Not supported value of type = " . $type );
}
if ( $newobject !== null ) {
$result = $newobject -> fetch ( $elemid );
}
2015-05-04 10:29:26 +00:00
2025-03-16 19:45:04 +00:00
if ( $result >= 0 && $newobject !== null ) {
// Add into category
$result = $object -> add_type ( $newobject , $elementtype );
}
2024-11-15 13:09:04 +00:00
if ( $result >= 0 ) {
setEventMessages ( $langs -> trans ( " WasAddedSuccessfully " , $newobject -> ref ), null , 'mesgs' );
} else {
if ( $object -> error == 'DB_ERROR_RECORD_ALREADY_EXISTS' ) {
setEventMessages ( $langs -> trans ( " ObjectAlreadyLinkedToCategory " ), null , 'warnings' );
2020-05-21 13:05:19 +00:00
} else {
2024-11-15 13:09:04 +00:00
setEventMessages ( $object -> error , $object -> errors , 'errors' );
2014-10-09 15:18:14 +00:00
}
}
}
2014-10-07 19:39:10 +00:00
2005-04-13 12:04:02 +00:00
2006-03-03 20:52:01 +00:00
/*
2008-07-01 19:30:39 +00:00
* View
2006-03-03 20:52:01 +00:00
*/
2008-07-01 19:30:39 +00:00
2011-11-08 09:18:45 +00:00
$form = new Form ( $db );
2015-09-17 17:51:56 +00:00
$formother = new FormOther ( $db );
2008-07-16 16:27:26 +00:00
2024-11-15 13:09:04 +00:00
$arrayofjs = array (
2026-02-08 22:11:40 +00:00
'/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.js' ,
'/public/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'
2024-11-15 13:09:04 +00:00
);
2026-02-08 22:11:40 +00:00
$arrayofcss = array ( '/public/includes/jquery/plugins/jquerytreeview/jquery.treeview.css' );
2021-03-19 08:27:29 +00:00
$help_url = '' ;
llxHeader ( " " , $langs -> trans ( " Categories " ), $help_url , '' , 0 , 0 , $arrayofjs , $arrayofcss );
2020-03-26 11:36:53 +00:00
2025-03-29 14:03:36 +00:00
$title = $langs -> trans ( " Categories " );
$title .= ' (' . $langs -> trans ( empty ( Categorie :: $MAP_TYPE_TITLE_AREA [ $type ]) ? ucfirst ( $type ) : Categorie :: $MAP_TYPE_TITLE_AREA [ $type ]) . ')' ;
2007-11-10 12:51:57 +00:00
2019-01-27 10:55:16 +00:00
$head = categories_prepare_head ( $object , $type );
2020-10-22 20:50:03 +00:00
print dol_get_fiche_head ( $head , 'card' , $langs -> trans ( $title ), - 1 , 'category' );
2020-11-21 14:57:11 +00:00
2025-04-26 10:06:45 +00:00
$backtolist = ( GETPOST ( 'backtolist' ) ? GETPOST ( 'backtolist' ) : DOL_URL_ROOT . '/categories/categorie_list.php?leftmenu=cat&type=' . urlencode ( $type ));
2021-03-14 14:06:40 +00:00
$linkback = '<a href="' . dol_sanitizeUrl ( $backtolist ) . '">' . $langs -> trans ( " BackToList " ) . '</a>' ;
2024-11-15 13:09:04 +00:00
$object -> next_prev_filter = 'type:=:' . (( int ) $object -> type );
2017-01-22 11:13:32 +00:00
$object -> ref = $object -> label ;
2025-10-29 15:50:09 +00:00
$morehtmlref = '<br><div class="refidno"><a href="' . DOL_URL_ROOT . '/categories/categorie_list.php?leftmenu=cat&type=' . urlencode ( $type ) . '">' . $langs -> trans ( " Root " ) . '</a>' ;
$morehtmlref .= ' > ' ;
$ways = $object -> print_all_ways ( " auto " , '' , 1 , 0 , 1 );
2021-02-23 17:04:37 +00:00
foreach ( $ways as $way ) {
2020-10-31 13:32:18 +00:00
$morehtmlref .= $way . " <br> \n " ;
2017-01-22 11:13:32 +00:00
}
2020-04-10 08:59:32 +00:00
$morehtmlref .= '</div>' ;
2017-01-22 11:13:32 +00:00
2021-03-14 14:06:40 +00:00
dol_banner_tab ( $object , 'label' , $linkback , ( $user -> socid ? 0 : 1 ), 'label' , 'label' , $morehtmlref , '&type=' . urlencode ( $type ), 0 , '' , '' , 1 );
2017-01-22 11:13:32 +00:00
2006-03-03 20:52:01 +00:00
2024-11-08 08:13:34 +00:00
// Confirmation of deletion
2021-02-23 17:04:37 +00:00
if ( $action == 'delete' ) {
2020-11-21 21:40:31 +00:00
if ( $backtopage ) {
2025-02-06 11:32:00 +00:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id . '&type=' . urlencode ( $type ) . '&backtopage=' . urlencode ( $backtopage ), $langs -> trans ( 'DeleteCategory' ), $langs -> trans ( 'ConfirmDeleteCategory' ), 'confirm_delete' , '' , '' , 2 );
2020-11-21 21:40:31 +00:00
} else {
2025-02-06 11:32:00 +00:00
print $form -> formconfirm ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id . '&type=' . urlencode ( $type ), $langs -> trans ( 'DeleteCategory' ), $langs -> trans ( 'ConfirmDeleteCategory' ), 'confirm_delete' , '' , '' , 1 );
2020-11-21 21:40:31 +00:00
}
2007-02-22 20:59:41 +00:00
}
2017-01-22 11:13:32 +00:00
print '<br>' ;
2005-04-13 12:04:02 +00:00
2017-04-05 12:48:24 +00:00
print '<div class="fichecenter">' ;
2017-01-22 11:13:32 +00:00
print '<div class="underbanner clearboth"></div>' ;
2020-05-26 12:43:50 +00:00
print '<table class="border centpercent tableforfield">' ;
2006-08-15 18:52:02 +00:00
2009-07-22 17:02:49 +00:00
// Description
2017-04-09 13:02:55 +00:00
print '<tr><td class="titlefield notopnoleft tdtop">' ;
2006-08-15 18:52:02 +00:00
print $langs -> trans ( " Description " ) . '</td><td>' ;
2015-05-14 18:49:22 +00:00
print dol_htmlentitiesbr ( $object -> description );
2006-08-15 18:52:02 +00:00
print '</td></tr>' ;
2015-09-17 17:51:56 +00:00
// Color
print '<tr><td class="notopnoleft">' ;
print $langs -> trans ( " Color " ) . '</td><td>' ;
print $formother -> showColor ( $object -> color );
print '</td></tr>' ;
2024-01-17 20:11:42 +00:00
// Position
print '<tr><td class="titlefield notopnoleft">' ;
print $langs -> trans ( " Position " ) . '</td><td>' ;
2025-05-05 17:52:34 +00:00
print $object -> position ? $object -> position : '' ;
2024-01-17 20:11:42 +00:00
print '</td></tr>' ;
2017-06-07 14:44:04 +00:00
// Other attributes
2019-11-13 18:35:39 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php' ;
2014-03-16 15:04:18 +00:00
2006-08-15 18:52:02 +00:00
print '</table>' ;
2017-04-05 12:48:24 +00:00
print '</div>' ;
2006-08-15 18:52:02 +00:00
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2006-08-15 18:52:02 +00:00
/*
* Boutons actions
*/
2015-05-14 18:49:22 +00:00
2006-08-15 18:52:02 +00:00
print " <div class='tabsAction'> \n " ;
2021-02-05 10:36:12 +00:00
$reshook = $hookmanager -> executeHooks ( 'addMoreActionsButtons' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2021-02-23 17:04:37 +00:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2021-02-05 10:36:12 +00:00
if ( empty ( $reshook )) {
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'categorie' , 'creer' )) {
2025-10-17 00:31:07 +00:00
$socid = ( $object -> socid ? $object -> socid : " " );
print '<a class="butAction" href="' . dolBuildUrl ( DOL_URL_ROOT . '/categories/edit.php' , [ 'id' => $object -> id , 'socid' => $socid , 'type' => $type ]) . '">' . $langs -> trans ( " Modify " ) . '</a>' ;
2021-02-05 10:36:12 +00:00
}
2006-08-15 18:52:02 +00:00
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'categorie' , 'supprimer' )) {
2025-10-17 00:31:07 +00:00
print '<a class="butActionDelete" href="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ], [ 'action' => 'delete' , 'id' => $object -> id , 'type' => $type , 'backtolist' => $backtolist ], true ) . '">' . $langs -> trans ( " Delete " ) . '</a>' ;
2021-02-05 10:36:12 +00:00
}
2006-08-15 18:52:02 +00:00
}
2005-04-13 12:04:02 +00:00
print " </div> " ;
2020-04-02 12:32:54 +00:00
$newcardbutton = '' ;
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'categorie' , 'creer' )) {
2025-10-17 00:31:07 +00:00
$link = dolBuildUrl ( DOL_URL_ROOT . '/categories/card.php' , [ 'action' => 'create' , 'type' => $type , 'catorigin' => $object -> id , 'backtopage' => dolBuildUrl ( $_SERVER [ " PHP_SELF " ], [ 'type' => $type , 'id' => $id ])]);
2020-03-25 09:31:40 +00:00
2020-04-02 12:32:54 +00:00
$newcardbutton = '<div class="right">' ;
$newcardbutton .= dolGetButtonTitle ( $langs -> trans ( 'NewCategory' ), '' , 'fa fa-plus-circle' , $link );
$newcardbutton .= '</div>' ;
2020-03-25 09:31:40 +00:00
}
2006-08-15 18:52:02 +00:00
2020-03-26 11:36:53 +00:00
/*
* Sub - category tree view of this category
*/
print '<div class="fichecenter">' ;
2020-04-02 12:32:54 +00:00
2020-04-09 14:36:39 +00:00
print load_fiche_titre ( $langs -> trans ( " SubCats " ), $newcardbutton , 'object_category' );
2020-04-02 12:32:54 +00:00
2025-05-05 17:34:26 +00:00
$cats = $object -> get_filles ();
2024-11-08 08:38:35 +00:00
print '<table class="liste nohover noborder centpercent borderbottom">' ;
2020-03-26 11:36:53 +00:00
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " SubCats " ) . '</td>' ;
print '<td></td>' ;
print '<td class="right">' ;
2025-05-05 17:34:26 +00:00
if ( is_array ( $cats ) && count ( $cats ) > 1 && ! empty ( $conf -> use_javascript_ajax )) {
2020-03-26 11:36:53 +00:00
print '<div id="iddivjstreecontrol">' ;
2020-04-21 22:55:38 +00:00
print '<a class="notasortlink" href="#">' . img_picto ( '' , 'folder' ) . ' ' . $langs -> trans ( " UndoExpandAll " ) . '</a>' ;
2020-03-26 11:36:53 +00:00
print " | " ;
2020-04-21 22:55:38 +00:00
print '<a class="notasortlink" href="#">' . img_picto ( '' , 'folder-open' ) . ' ' . $langs -> trans ( " ExpandAll " ) . '</a>' ;
2020-03-26 11:36:53 +00:00
print '</div>' ;
}
print '</td>' ;
print '</tr>' ;
2025-05-05 17:34:26 +00:00
if ( is_numeric ( $cats ) && $cats < 0 ) {
2020-09-28 07:13:15 +00:00
dol_print_error ( $db , $object -> error , $object -> errors );
2021-02-23 17:04:37 +00:00
} elseif ( count ( $cats ) < 1 ) {
2025-05-05 17:52:34 +00:00
print '<tr class="oddeven nobottom nohover">' ;
2022-12-27 00:45:00 +00:00
print '<td colspan="3"><span class="opacitymedium">' . $langs -> trans ( " NoSubCat " ) . '</span></td>' ;
2020-03-26 11:36:53 +00:00
print '</tr>' ;
2020-05-21 13:05:19 +00:00
} else {
2020-03-26 11:36:53 +00:00
$categstatic = new Categorie ( $db );
2020-04-11 22:37:05 +00:00
$fulltree = $categstatic -> get_full_arbo ( $type , $object -> id , 1 );
2020-03-26 11:36:53 +00:00
// Load possible missing includes
2022-07-25 16:45:02 +00:00
if ( getDolGlobalString ( 'CATEGORY_SHOW_COUNTS' )) {
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_MEMBER ) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
}
if ( $type == Categorie :: TYPE_ACCOUNT ) {
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
}
if ( $type == Categorie :: TYPE_PROJECT ) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
}
if ( $type == Categorie :: TYPE_USER ) {
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
}
2010-03-20 00:07:47 +00:00
}
2020-03-26 11:36:53 +00:00
// Define data (format for treeview)
$data = array ();
2024-11-04 11:32:13 +00:00
$data [] = array ( 'rowid' => 0 , 'fk_menu' => - 1 , 'title' => 'racine' , 'mainmenu' => '' , 'leftmenu' => '' , 'fk_mainmenu' => '' , 'fk_leftmenu' => '' );
2021-02-23 17:04:37 +00:00
foreach ( $fulltree as $key => $val ) {
2020-03-26 11:36:53 +00:00
$categstatic -> id = $val [ 'id' ];
$categstatic -> ref = $val [ 'label' ];
$categstatic -> color = $val [ 'color' ];
$categstatic -> type = $type ;
2024-11-08 08:13:34 +00:00
//$desc = dol_htmlcleanlastbr($val['description']);
2020-03-26 11:36:53 +00:00
2020-11-21 21:40:31 +00:00
$counter = '' ;
2022-07-25 16:45:02 +00:00
if ( getDolGlobalString ( 'CATEGORY_SHOW_COUNTS' )) {
2020-03-26 11:36:53 +00:00
// we need only a count of the elements, so it is enough to consume only the id's from the database
2022-07-25 16:45:02 +00:00
$elements = $categstatic -> getObjectsInCateg ( $type , 1 );
2020-03-26 11:36:53 +00:00
2021-11-28 14:43:22 +00:00
$counter = " <td class='left' width='40px;'> " . ( is_array ( $elements ) ? count ( $elements ) : '0' ) . " </td> " ;
2006-03-03 20:52:01 +00:00
}
2020-03-26 11:36:53 +00:00
2024-11-08 08:13:34 +00:00
if ( $categstatic -> color ) {
$stylecolor = ' style="background: #' . sprintf ( " %06s " , $categstatic -> color ) . ';"' ;
} else {
$stylecolor = ' style="background: #bbb;"' ;
}
$li = $categstatic -> getNomUrl ( 1 , '' , 60 , '&backtolist=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . (( int ) $id ) . '&type=' . urlencode ( $type )), 0 );
2020-03-26 11:36:53 +00:00
$entry = '<table class="nobordernopadding centpercent">' ;
$entry .= '<tr>' ;
$entry .= '<td>' ;
2024-11-08 08:13:34 +00:00
$entry .= '<span class="noborderoncategories" ' . $stylecolor . '>' . $li . '</span>' ;
2020-03-26 11:36:53 +00:00
$entry .= '</td>' ;
2020-11-21 21:40:31 +00:00
$entry .= $counter ;
2020-03-26 11:36:53 +00:00
$entry .= '<td class="right" width="20px;">' ;
2025-02-06 11:32:00 +00:00
$entry .= '<a href="' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $val [ 'id' ] . '&type=' . urlencode ( $type ) . '&backtolist=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $id . '&type=' . urlencode ( $type )) . '">' . img_view () . '</a>' ;
2020-11-21 21:40:31 +00:00
$entry .= '</td>' ;
$entry .= '<td class="right" width="20px;">' ;
2025-02-06 11:32:00 +00:00
$entry .= '<a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val [ 'id' ] . '&type=' . urlencode ( $type ) . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $id . '&type=' . urlencode ( $type )) . '">' . img_edit () . '</a>' ;
2020-11-21 21:40:31 +00:00
$entry .= '</td>' ;
$entry .= '<td class="right" width="20px;">' ;
2025-02-06 11:32:00 +00:00
$entry .= '<a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken () . '&id=' . $val [ 'id' ] . '&type=' . urlencode ( $type ) . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $id . '&type=' . urlencode ( $type )) . '&backtolist=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $id . '&type=' . urlencode ( $type )) . '">' . img_delete () . '</a>' ;
2020-03-26 11:36:53 +00:00
$entry .= '</td>' ;
$entry .= '</tr>' ;
$entry .= '</table>' ;
$data [] = array ( 'rowid' => $val [ 'rowid' ], 'fk_menu' => $val [ 'fk_parent' ], 'entry' => $entry );
}
2020-11-21 21:40:31 +00:00
$nbofentries = ( count ( $data ) - 1 );
2021-02-23 17:04:37 +00:00
if ( $nbofentries > 0 ) {
2020-03-26 11:36:53 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/treeview.lib.php' ;
print '<tr class="pair">' ;
print '<td colspan="3">' ;
// $data[0] is the current shown category, to don'T show the current category use $data[1] instead
tree_recur ( $data , $data [ 1 ], 0 );
print '</td>' ;
print '</tr>' ;
2020-05-21 13:05:19 +00:00
} else {
2020-03-26 11:36:53 +00:00
print '<tr class="pair">' ;
print '<td colspan="3">' ;
print '<table class="nobordernopadding">' ;
print '<tr class="nobordernopadding">' ;
print '<td>' . img_picto_common ( '' , 'treemenu/branchbottom.gif' ) . '</td>' ;
2023-07-01 14:07:58 +00:00
print '<td class="valignmiddle"><span class="opacitymedium">' . $langs -> trans ( " NoCategoryYet " ) . '</span></td>' ;
2020-03-26 11:36:53 +00:00
print '<td> </td>' ;
print '</tr>' ;
print '</table>' ;
print '</td>' ;
print '</tr>' ;
2006-03-03 20:52:01 +00:00
}
2005-04-13 12:04:02 +00:00
}
2020-03-26 11:36:53 +00:00
print " </table> " ;
print " </div> " ;
2015-12-19 12:55:27 +00:00
2019-09-09 23:44:36 +00:00
// List of mass actions available
2019-11-13 18:35:39 +00:00
$arrayofmassactions = array (
2019-09-09 23:44:36 +00:00
//'validate'=>$langs->trans("Validate"),
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
2019-11-13 18:35:39 +00:00
$massactionbutton = $form -> selectMassAction ( '' , $arrayofmassactions );
2019-09-09 23:44:36 +00:00
2025-02-06 11:32:00 +00:00
$typeid = $type ; // warning, typeid can be a string
2020-04-02 12:32:54 +00:00
2014-10-07 19:39:10 +00:00
// List of products or services (type is type of category)
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_PRODUCT ) {
2023-07-05 08:14:31 +00:00
if ( $user -> hasRight ( " product " , " read " ) || $user -> hasRight ( " service " , " read " )) {
2023-07-06 20:22:26 +00:00
$permission = ( $user -> hasRight ( 'produit' , 'creer' ) || $user -> hasRight ( 'service' , 'creer' ));
2024-11-15 13:09:04 +00:00
$showclassifyform = ( $user -> hasRight ( 'produit' , 'creer' ) || $user -> hasRight ( 'service' , 'creer' ));
2022-08-29 09:22:27 +00:00
2024-12-03 18:20:51 +00:00
$prods = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset , 'ref' );
2022-08-29 09:22:27 +00:00
if ( $prods < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Product[] $prods */
2024-03-24 19:01:27 +00:00
'@phan-var-force Product[] $prods' ;
2023-07-01 14:07:58 +00:00
// Form to add record into the category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2014-10-09 15:18:14 +00:00
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2020-04-02 12:32:54 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $prods );
$nbtotalofrecords = '' ;
2024-07-10 16:59:04 +00:00
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( " AddProduct " ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/product/card.php?action=create&categories[]=' . $object -> id . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id ), '' , $user -> hasRight ( 'societe' , 'creer' ));
2023-07-01 14:07:58 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " ProductsAndServices " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'products' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddProductServiceIntoCategory " ) . ' ' ;
2024-11-11 23:35:14 +00:00
$form -> select_produits ( 0 , 'elemid' , '' , 0 , 0 , - 1 , 2 , '' , 1 , array (), 0 , 1 , 0 , '' , 0 , '' , null );
2024-11-08 09:08:06 +00:00
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2022-08-29 09:22:27 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2026-03-16 19:43:16 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
2022-08-29 09:22:27 +00:00
if ( count ( $prods ) > 0 ) {
$i = 0 ;
foreach ( $prods as $prod ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
2025-05-05 17:52:34 +00:00
print '<tr class="oddeven">' . " \n " ;
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
print $prod -> getNomUrl ( 1 );
print " </td> \n " ;
2026-03-16 19:43:16 +00:00
$product_thumbnail_html = '' ;
if ( ! empty ( $prod -> entity )) {
$product_thumbnail = $prod -> show_photos ( 'product' , $conf -> product -> multidir_output [( int ) $prod -> entity ], 1 , 1 , 0 , 0 , 0 , 80 );
if ( $prod -> nbphoto > 0 ) {
$product_thumbnail_html = $product_thumbnail ;
}
}
print '<td class="left">' . $product_thumbnail_html . '</td>' ;
$product_stock_info = " " ;
if ( isModEnabled ( " stock " ) && ( $user -> hasRight ( " stock " , " read " ))) {
2026-03-20 14:37:41 +00:00
$product_stock_info = " <br> " . $langs -> trans ( " Stock " ) . " : " . $prod -> stock_reel ;
2026-03-16 19:43:16 +00:00
}
print '<td class="tdtop">' . dolPrintHTML ( $prod -> label ) . " <br> " . dolPrintHTML ( $prod -> description ) . $product_stock_info . " </td> \n " ;
2022-08-29 09:22:27 +00:00
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print '<a class="reposition" href= "' . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . (( int ) $object -> id ) . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $prod -> id ) . ( $limit ? '&limit=' . $limit : '' ) . '">' ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
2013-04-21 21:44:33 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2007-04-30 10:53:58 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " ProductsAndServices " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'products' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2007-04-30 10:53:58 +00:00
}
2005-04-13 12:04:02 +00:00
}
2007-04-30 10:53:58 +00:00
2021-10-22 15:15:51 +00:00
// List of customers
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_CUSTOMER ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " societe " , " read " )) {
2023-02-20 17:55:52 +00:00
$permission = $user -> hasRight ( 'societe' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'societe' , 'creer' );
2022-08-29 09:22:27 +00:00
2024-12-03 18:20:51 +00:00
$socs = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset , 'nom' );
2022-08-29 09:22:27 +00:00
if ( $socs < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Societe[] $socs */
2024-03-24 19:01:27 +00:00
'@phan-var-force Societe[] $socs' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2020-10-22 14:12:01 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2020-10-22 14:12:01 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $socs );
$nbtotalofrecords = '' ;
2025-06-13 14:12:30 +00:00
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( " AddThirdParty " ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/societe/card.php?action=create&customer=3&custcats[]=' . $object -> id . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id ), '' , $user -> hasRight ( 'societe' , 'creer' ));
2023-07-01 14:07:58 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Customers " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'companies' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddCustomerIntoCategory " ) . ' ' ;
2024-11-16 09:58:48 +00:00
$filter = '(s.client:IN:1,2,3)' ;
2024-11-08 09:08:06 +00:00
print $form -> select_company ( '' , 'elemid' , $filter );
print '<input type="submit" class="reposition button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2022-08-29 09:22:27 +00:00
print '<table class="noborder centpercent">' . " \n " ;
print '<tr class="liste_titre"><td colspan="2">' . $langs -> trans ( " Name " ) . '</td></tr>' . " \n " ;
if ( count ( $socs ) > 0 ) {
$i = 0 ;
foreach ( $socs as $key => $soc ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2024-11-08 08:13:34 +00:00
print '<td class="nowrap tdtop tdoverflowmax250">' ;
2022-08-29 09:22:27 +00:00
print $soc -> getNomUrl ( 1 );
print " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $soc -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
2013-06-05 14:24:32 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2007-04-30 10:53:58 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Customers " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'companies' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2007-04-30 10:53:58 +00:00
}
}
2021-10-22 15:15:51 +00:00
// List of suppliers
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_SUPPLIER ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " fournisseur " , " read " )) {
2023-02-20 17:55:52 +00:00
$permission = $user -> hasRight ( 'societe' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'societe' , 'creer' );
2022-08-29 09:22:27 +00:00
2024-12-03 18:20:51 +00:00
$socs = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset , 'nom' );
2024-04-10 14:31:50 +00:00
2022-08-29 09:22:27 +00:00
if ( $socs < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Fournisseur[] $socs */
2024-03-24 19:01:27 +00:00
'@phan-var-force Fournisseur[] $socs' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2020-10-22 14:12:01 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2017-06-07 14:44:04 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $socs );
$nbtotalofrecords = '' ;
2024-07-10 16:59:04 +00:00
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( " AddSupplier " ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/societe/card.php?action=create&fournisseur=1&suppcats[]=' . $object -> id . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id ), '' , $user -> hasRight ( 'societe' , 'creer' ));
2023-07-01 14:07:58 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Suppliers " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'companies' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddSupplierIntoCategory " ) . ' ' ;
$filter = '(s.fournisseur:=:1)' ;
print $form -> select_company ( '' , 'elemid' , $filter );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2022-08-29 09:22:27 +00:00
print '<table class="noborder centpercent">' . " \n " ;
print '<tr class="liste_titre"><td colspan="2">' . $langs -> trans ( " Name " ) . " </td></tr> \n " ;
if ( count ( $socs ) > 0 ) {
$i = 0 ;
foreach ( $socs as $soc ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
print $soc -> getNomUrl ( 1 );
print " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print '<a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $soc -> id ) . ( $limit ? '&limit=' . $limit : '' ) . '">' ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
2013-06-05 14:24:32 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2007-04-30 10:53:58 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Suppliers " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'companies' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2006-03-03 20:52:01 +00:00
}
2005-04-13 12:04:02 +00:00
}
2010-03-20 00:07:47 +00:00
// List of members
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_MEMBER ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " adherent " , " read " )) {
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php' ;
2010-03-20 00:07:47 +00:00
2022-09-09 08:29:27 +00:00
$permission = $user -> hasRight ( 'adherent' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'adherent' , 'creer' );
2022-08-29 09:22:27 +00:00
2024-12-03 18:20:51 +00:00
$members = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset , 'lastname' );
2024-01-12 16:11:08 +00:00
if ( $members < 0 ) {
2022-08-29 09:22:27 +00:00
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Adherent[] $members */
2024-03-24 19:01:27 +00:00
'@phan-var-force Adherent[] $members' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-10-22 14:13:54 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2019-09-09 23:44:36 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
2024-01-12 16:11:08 +00:00
$num = count ( $members );
2023-07-01 14:07:58 +00:00
$nbtotalofrecords = '' ;
2022-09-09 08:29:27 +00:00
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( " AddMember " ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/adherents/card.php?action=create&memcats[]=' . $object -> id . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id ), '' , $user -> hasRight ( 'adherent' , 'creer' ));
2023-07-01 14:07:58 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Member " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'members' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AssignCategoryTo " ) . ' ' ;
print $form -> selectMembers ( '' , 'elemid' );
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " Save " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2024-09-29 11:09:09 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2022-08-29 09:22:27 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Name " ) . '</td></tr>' . " \n " ;
2024-01-12 16:11:08 +00:00
if ( count ( $members ) > 0 ) {
2022-08-29 09:22:27 +00:00
$i = 0 ;
2024-01-12 16:11:08 +00:00
foreach ( $members as $key => $member ) {
2022-08-29 09:22:27 +00:00
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
$member -> ref = $member -> login ;
print $member -> getNomUrl ( 1 , 0 );
print " </td> \n " ;
print '<td class="tdtop">' . $member -> lastname . " </td> \n " ;
print '<td class="tdtop">' . $member -> firstname . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $member -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
2023-07-01 14:07:58 +00:00
print '</td>' ;
2022-08-29 09:22:27 +00:00
print " </tr> \n " ;
2013-04-21 21:44:33 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2010-03-20 00:07:47 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Member " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'members' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2010-03-20 00:07:47 +00:00
}
}
2022-07-29 10:31:51 +00:00
// List of contacts
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_CONTACT ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " societe " , " read " )) {
2023-02-20 17:55:52 +00:00
$permission = $user -> hasRight ( 'societe' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'societe' , 'creer' );
2020-04-02 12:32:54 +00:00
2024-12-03 18:20:51 +00:00
$contacts = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset , 'lastname' );
2022-08-29 09:22:27 +00:00
if ( is_numeric ( $contacts ) && $contacts < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Contact[] $contacts */
2024-03-24 19:01:27 +00:00
'@phan-var-force Contact[] $contacts' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-10-22 14:46:55 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2017-06-07 14:44:04 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $contacts );
$nbtotalofrecords = '' ;
2024-07-10 16:59:04 +00:00
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( " AddContact " ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/contact/card.php?action=create&contcats[]=' . $object -> id . '&backtopage=' . urlencode ( $_SERVER [ " PHP_SELF " ] . '?id=' . $object -> id ), '' , $user -> hasRight ( 'societe' , 'creer' ));
2023-07-01 14:07:58 +00:00
2024-11-08 09:08:06 +00:00
$objsoc = new Societe ( $db );
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Contact " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'contact' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AssignCategoryTo " ) . ' ' ;
print $form -> select_contact ( 0 , '' , 'elemid' , '' , '' , '' , 0 , 'maxwidth300 widthcentpercentminusx' );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2023-07-01 14:07:58 +00:00
2022-08-29 09:22:27 +00:00
print '<table class="noborder centpercent">' . " \n " ;
print '<tr class="liste_titre"><td colspan="2">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( is_array ( $contacts ) && count ( $contacts ) > 0 ) {
$i = 0 ;
foreach ( $contacts as $key => $contact ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
print $contact -> getNomUrl ( 1 , 'category' );
if ( $contact -> socid > 0 ) {
$objsoc -> fetch ( $contact -> socid );
print ' - ' ;
print $objsoc -> getNomUrl ( 1 , 'contact' );
}
print " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $contact -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
2013-07-30 15:04:09 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2013-07-30 15:04:09 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Contact " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'contact' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2013-07-30 15:04:09 +00:00
}
}
2020-04-09 14:36:39 +00:00
// List of bank accounts
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_ACCOUNT ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " banque " , " read " )) {
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php' ;
2020-10-31 13:32:18 +00:00
2023-06-19 18:54:08 +00:00
$permission = $user -> hasRight ( 'banque' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'banque' , 'creer' );
2022-08-29 09:22:27 +00:00
$accounts = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $accounts < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Account[] $accounts */
2024-03-24 19:01:27 +00:00
'@phan-var-force Account[] $accounts' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-10-22 15:15:51 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2020-10-31 13:32:18 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $accounts );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Account " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'bank_account' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddObjectIntoCategory " ) . ' ' ;
print $form -> select_comptes ( '' , 'elemid' , 0 , '' , 0 , '' , 0 , '' , 1 );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2024-09-29 11:09:09 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2022-08-29 09:22:27 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $accounts ) > 0 ) {
$i = 0 ;
foreach ( $accounts as $key => $account ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2025-03-16 19:45:04 +00:00
print $account -> getNomUrl ( 1 , '0' );
2022-08-29 09:22:27 +00:00
print " </td> \n " ;
print '<td class="tdtop">' . $account -> bank . " </td> \n " ;
print '<td class="tdtop">' . $account -> number . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $account -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
2023-07-01 14:07:58 +00:00
print '</td>' ;
2022-08-29 09:22:27 +00:00
print " </tr> \n " ;
2020-10-31 13:32:18 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2020-10-31 13:32:18 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2020-10-31 13:32:18 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Banque " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'bank' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2020-10-31 13:32:18 +00:00
}
2016-04-30 12:45:24 +00:00
}
2005-04-13 12:04:02 +00:00
2016-08-29 08:41:14 +00:00
// List of Project
2022-08-05 14:22:03 +00:00
if ( $type == Categorie :: TYPE_PROJECT ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " project " , " read " )) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
2016-08-29 08:41:14 +00:00
2024-02-09 14:58:49 +00:00
$permission = $user -> hasRight ( 'projet' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'projet' , 'creer' );
2022-08-29 09:22:27 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2025-11-08 13:01:19 +00:00
/** @var Project[] $objects */
'@phan-var-force Project[] $objects' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-10-22 13:48:39 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2019-09-09 23:44:36 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2022-08-29 09:22:27 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Project " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'project' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddObjectIntoCategory " ) . ' ' ;
$form -> selectProjects ( '' , 'elemid' );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2024-09-29 11:09:09 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2022-08-29 09:22:27 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
foreach ( $objects as $key => $project ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
print $project -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $project -> title . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $project -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
2023-07-01 14:07:58 +00:00
print '</td>' ;
2022-08-29 09:22:27 +00:00
print " </tr> \n " ;
2016-08-29 08:41:14 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2016-08-29 08:41:14 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2019-09-09 23:44:36 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Project " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'project' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2016-08-29 08:41:14 +00:00
}
}
2020-02-03 10:01:58 +00:00
// List of users
2022-08-29 09:22:27 +00:00
if ( $type == Categorie :: TYPE_USER ) {
if ( $user -> hasRight ( " user " , " user " , " read " )) {
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( " user " , " user " , " creer " );
2020-02-03 10:01:58 +00:00
2024-12-04 14:14:53 +00:00
$users = $object -> getObjectsInCateg ( $type , 0 , 0 , 0 , 'lastname' );
2022-08-29 09:22:27 +00:00
if ( $users < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var User[] $users */
2024-03-24 19:01:27 +00:00
'@phan-var-force User[] $users' ;
2025-12-21 10:26:14 +00:00
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-10-22 14:54:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $users );
2023-07-01 14:07:58 +00:00
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2022-08-29 09:22:27 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2023-07-01 14:07:58 +00:00
print_barre_liste ( $langs -> trans ( " Users " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'user' , 0 , '' , '' , $limit );
2022-08-29 09:22:27 +00:00
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
$force_entity = getEntity ( $object -> element ); // So we will get same filter than the getObjectsInCateg()
print img_picto ( '' , $type , 'class="pictofixedwidth"' );
print $form -> select_dolusers ( '' , 'elemid' , 1 , null , 0 , '' , '' , $force_entity );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2024-09-29 11:09:09 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<tr class="liste_titre"><td colspan="3">' . $langs -> trans ( " Users " ) . ' <span class="badge">' . $num . '</span></td></tr>' . " \n " ;
2022-08-29 09:22:27 +00:00
if ( count ( $users ) > 0 ) {
// Use "$userentry" here, because "$user" is the current user
foreach ( $users as $key => $userentry ) {
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
print $userentry -> getNomUrl ( - 1 );
2022-08-29 09:22:27 +00:00
print " </td> \n " ;
print '<td class="tdtop">' . $userentry -> job . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
2023-06-19 18:08:27 +00:00
if ( $user -> hasRight ( 'user' , 'user' , 'creer' )) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $userentry -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
2023-07-01 14:07:58 +00:00
print '</td>' ;
2022-08-29 09:22:27 +00:00
print " </tr> \n " ;
2020-02-03 10:01:58 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="3"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2020-02-03 10:01:58 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2020-04-02 12:32:54 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Users " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'user' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2020-02-03 10:01:58 +00:00
}
}
2020-09-28 06:31:39 +00:00
// List of warehouses
2021-02-23 17:04:37 +00:00
if ( $type == Categorie :: TYPE_WAREHOUSE ) {
2022-12-27 00:45:00 +00:00
if ( $user -> hasRight ( " stock " , " read " )) {
2024-01-12 16:11:08 +00:00
$permission = $user -> hasRight ( 'stock' , 'creer' );
2025-12-21 10:26:14 +00:00
$showclassifyform = $user -> hasRight ( 'stock' , 'creer' );
2020-04-02 12:32:54 +00:00
2022-08-29 09:22:27 +00:00
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php' ;
2020-04-02 12:32:54 +00:00
2022-08-29 09:22:27 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Entrepot[] $objects */
2024-03-24 19:01:27 +00:00
'@phan-var-force Entrepot[] $objects' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2020-04-02 12:32:54 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2022-08-29 09:22:27 +00:00
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Warehouses " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'stock' , 0 , $newcardbutton , '' , $limit );
2025-12-21 10:26:14 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddTicketIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'Entrepot:product/stock/class/entrepot.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2025-12-21 10:26:14 +00:00
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2024-09-29 11:09:09 +00:00
print '<table class="noborder centpercent">' . " \n " ;
2022-08-29 09:22:27 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
2024-01-12 16:11:08 +00:00
foreach ( $objects as $key => $warehouse ) {
2022-08-29 09:22:27 +00:00
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2024-01-12 16:11:08 +00:00
print $warehouse -> getNomUrl ( 1 );
2022-08-29 09:22:27 +00:00
print " </td> \n " ;
2024-01-12 16:11:08 +00:00
print '<td class="tdtop">' . $warehouse -> ref . " </td> \n " ;
print '<td class="tdtop">' . $warehouse -> lieu . " </td> \n " ;
2022-08-29 09:22:27 +00:00
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $warehouse -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
2023-07-01 14:07:58 +00:00
print '</td>' ;
2022-08-29 09:22:27 +00:00
print " </tr> \n " ;
2020-04-02 12:32:54 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2020-04-02 12:32:54 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2020-04-02 12:32:54 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Warehouse " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'stock' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2020-04-02 12:32:54 +00:00
}
}
2022-07-29 10:31:51 +00:00
// List of tickets
2021-07-12 07:17:08 +00:00
if ( $type == Categorie :: TYPE_TICKET ) {
2022-08-29 09:22:27 +00:00
if ( $user -> hasRight ( " ticket " , " read " )) {
2024-07-10 16:59:04 +00:00
$permission = $user -> hasRight ( 'categorie' , 'creer' );
2024-11-15 13:09:04 +00:00
$showclassifyform = $user -> hasRight ( 'categorie' , 'creer' );
2022-08-29 09:22:27 +00:00
$tickets = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $tickets < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2024-01-12 16:11:08 +00:00
/** @var Ticket[] $tickets */
2024-03-24 19:01:27 +00:00
'@phan-var-force Ticket[] $tickets' ;
2022-08-29 09:22:27 +00:00
// Form to add record into a category
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2021-07-01 17:30:00 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
2024-11-08 09:08:06 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2022-08-29 09:22:27 +00:00
print '<input type="hidden" name="action" value="list">' ;
2021-07-01 17:30:00 +00:00
2022-08-29 09:22:27 +00:00
print '<br>' ;
2023-07-01 14:07:58 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $tickets );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2024-03-08 11:34:25 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2022-08-29 09:22:27 +00:00
print_barre_liste ( $langs -> trans ( " Ticket " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'ticket' , 0 , $newcardbutton , '' , $limit );
2024-11-08 09:08:06 +00:00
if ( $showclassifyform ) {
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddTicketIntoCategory " ) . ' ' ;
$form -> selectTickets ( '' , 'elemid' );
print '<input type="submit" class="button buttongen" name="addintocategory" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
}
2022-08-29 09:22:27 +00:00
print '<table class="noborder centpercent">' . " \n " ;
print '<tr class="liste_titre"><td colspan="3">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $tickets ) > 0 ) {
$i = 0 ;
foreach ( $tickets as $ticket ) {
$i ++ ;
2023-12-04 11:01:45 +00:00
if ( $i > $limit ) {
break ;
}
2022-08-29 09:22:27 +00:00
print " \t " . '<tr class="oddeven">' . " \n " ;
2023-07-01 14:07:58 +00:00
print '<td class="nowrap tdtop">' ;
2022-08-29 09:22:27 +00:00
print $ticket -> getNomUrl ( 1 );
print " </td> \n " ;
2026-01-23 12:46:42 +00:00
print '<td class="tdtop">' . $ticket -> track_id . " </td> \n " ;
2022-08-29 09:22:27 +00:00
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $ticket -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-08 10:04:46 +00:00
//print $langs->trans("DeleteFromCat");
2024-09-25 20:21:31 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2022-08-29 09:22:27 +00:00
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
2021-07-01 17:30:00 +00:00
}
2022-08-29 09:22:27 +00:00
} else {
2023-07-01 14:07:58 +00:00
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
2021-07-01 17:30:00 +00:00
}
2022-08-29 09:22:27 +00:00
print " </table> \n " ;
2021-07-01 17:30:00 +00:00
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2022-08-29 09:22:27 +00:00
}
} else {
2024-07-09 17:28:59 +00:00
print_barre_liste ( $langs -> trans ( " Ticket " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'ticket' );
2022-09-09 11:58:54 +00:00
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
2021-07-01 17:30:00 +00:00
}
}
2020-04-02 12:32:54 +00:00
2024-11-15 13:09:04 +00:00
// List of Interventions
if ( $type == Categorie :: TYPE_FICHINTER ) {
if ( $user -> hasRight ( " fichinter " , " lire " )) {
$permission = $user -> hasRight ( 'categorie' , 'creer' );
$showclassifyform = $user -> hasRight ( 'categorie' , 'creer' );
$fichinters = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $fichinters < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2025-11-09 00:19:31 +00:00
/** @var Fichinter[] $fichinters */
'@phan-var-force Fichinter[] $fichinters' ;
2025-12-21 10:26:14 +00:00
2024-11-15 13:09:04 +00:00
// Form to add record into a category
if ( $showclassifyform ) {
print '<br>' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2024-11-15 13:09:04 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddFichinterIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'Fichinter:fichinter/class/fichinter.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2024-11-15 13:09:04 +00:00
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2024-11-15 13:09:04 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $fichinters );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
$langs -> load ( 'interventions' );
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste ( $langs -> trans ( " Intervention " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'object_intervention' , 0 , $newcardbutton , '' , $limit );
print '<table class="noborder centpercent">' . " \n " ;
print '<tr class="liste_titre"><td colspan="3">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $fichinters ) > 0 ) {
$i = 0 ;
foreach ( $fichinters as $fichinter ) {
$i ++ ;
2025-03-16 19:45:04 +00:00
if ( $i > $limit ) {
break ;
}
2024-11-15 13:09:04 +00:00
print " \t " . '<tr class="oddeven">' . " \n " ;
print '<td class="nowrap tdtop">' ;
print $fichinter -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $fichinter -> description . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-02-06 11:32:00 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . (( int ) $object -> id ) . " &type= " . urlencode ( $typeid ) . " &action=unlink&token= " . newToken () . " &removeelem= " . (( int ) $fichinter -> id ) . ( $limit ? '&limit=' . $limit : '' ) . " '> " ;
2024-11-15 13:09:04 +00:00
print $langs -> trans ( " DeleteFromCat " );
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
print " </a> " ;
}
print '</td>' ;
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</span></td></tr>' ;
}
print " </table> \n " ;
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2024-11-15 13:09:04 +00:00
}
} else {
print_barre_liste ( $langs -> trans ( " Intervention " ), null , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , 'fichinter' );
accessforbidden ( " NotEnoughPermissions " , 0 , 0 );
}
}
2025-02-14 13:29:49 +00:00
// List of Orders
if ( $type == Categorie :: TYPE_ORDER ) {
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
2025-09-18 14:26:38 +00:00
$permission = $user -> hasRight ( 'commande' , 'creer' );
2025-02-14 13:29:49 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
2025-11-09 00:19:31 +00:00
/** @var Commande[] $objects */
'@phan-var-force Commande[] $objects' ;
2025-02-14 13:29:49 +00:00
// Form to add record into a category
2025-02-17 10:46:29 +00:00
$showclassifyform = $user -> hasRight ( 'order' , 'write' );
2025-02-14 13:29:49 +00:00
if ( $showclassifyform ) {
print '<br>' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-02-14 13:29:49 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddOrderIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'Commande:commande/class/commande.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2025-02-14 13:29:49 +00:00
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-02-14 13:29:49 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
2025-03-16 19:45:04 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2025-02-14 13:29:49 +00:00
2024-08-26 13:45:38 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2025-02-14 13:29:49 +00:00
print_barre_liste ( $langs -> trans ( " Orders " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'bill' , 0 , $newcardbutton , '' , $limit );
2025-03-11 02:20:26 +00:00
print " <table class='noborder centpercent'> \n " ;
2025-02-14 13:29:49 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
2022-11-15 10:36:11 +00:00
foreach ( $objects as $key => $order ) {
2025-02-14 13:29:49 +00:00
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2025-03-11 02:20:26 +00:00
print '<td class="nowrap tdtop">' ;
2025-02-14 13:29:49 +00:00
print $order -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $order -> ref . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-12-20 12:53:43 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . $typeid . " &action=unlink&token= " . newToken () . " &removeelem= " . $order -> id . " '> " ;
2026-01-07 10:23:20 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
print " </a> " ;
}
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</td></tr>' ;
}
print " </table> \n " ;
print " </form> \n " ;
}
}
// List of Manufacturing Orders
if ( $type == Categorie :: TYPE_MO ) {
require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php' ;
$permission = $user -> hasRight ( 'mrp' , 'write' );
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
/** @var Mo[] $objects */
'@phan-var-force Mo[] $objects' ;
// Form to add record into a category
$showclassifyform = $user -> hasRight ( 'mrp' , 'write' );
if ( $showclassifyform ) {
print '<br>' ;
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddMoIntoCategory " ) . ' ' ;
print $form -> selectForForms ( 'Mo:mrp/class/mo.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste ( $langs -> trans ( " MOs " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'mrp' , 0 , $newcardbutton , '' , $limit );
print " <table class='noborder centpercent'> \n " ;
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
foreach ( $objects as $key => $mo ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
print '<td class="nowrap tdtop">' ;
print $mo -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $mo -> ref . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . $typeid . " &action=unlink&token= " . newToken () . " &removeelem= " . $mo -> id . " '> " ;
2025-02-14 14:46:40 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2025-02-14 13:29:49 +00:00
print " </a> " ;
}
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</td></tr>' ;
}
print " </table> \n " ;
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2025-02-14 13:29:49 +00:00
}
}
2025-02-27 05:51:00 +00:00
// List of Invoices
if ( $type == Categorie :: TYPE_INVOICE ) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
2025-09-18 14:26:38 +00:00
$permission = $user -> hasRight ( 'facture' , 'creer' );
2025-02-27 05:51:00 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
// Form to add record into a category
2025-02-27 08:34:59 +00:00
$showclassifyform = $user -> hasRight ( 'facture' , 'write' );
2025-02-27 05:51:00 +00:00
if ( $showclassifyform ) {
print '<br>' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-02-27 05:51:00 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddInvoiceIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'Facture:compta/facture/class/facture.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2025-02-27 05:51:00 +00:00
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-02-27 05:51:00 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
2025-03-16 19:45:04 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2025-02-27 05:51:00 +00:00
2025-02-27 08:34:59 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
2025-02-27 05:51:00 +00:00
print_barre_liste ( $langs -> trans ( " BillsCustomers " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'bill' , 0 , $newcardbutton , '' , $limit );
2025-03-11 02:20:26 +00:00
print " <table class='noborder centpercent'> \n " ;
2025-02-27 05:51:00 +00:00
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
foreach ( $objects as $key => $invoice ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
2025-03-11 02:20:26 +00:00
print '<td class="nowrap tdtop">' ;
2025-02-27 05:51:00 +00:00
print $invoice -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $invoice -> ref . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-12-20 12:53:43 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . $typeid . " &action=unlink&token= " . newToken () . " &removeelem= " . $invoice -> id . " '> " ;
2025-02-27 05:51:00 +00:00
print $langs -> trans ( " DeleteFromCat " );
2025-02-27 08:34:59 +00:00
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
2025-02-27 05:51:00 +00:00
print " </a> " ;
}
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</td></tr>' ;
}
print " </table> \n " ;
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2025-02-27 05:51:00 +00:00
}
}
2025-03-11 02:20:26 +00:00
// List of Supplier Orders
if ( $type == Categorie :: TYPE_SUPPLIER_ORDER ) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php' ;
2025-09-18 14:26:38 +00:00
$permission = $user -> hasRight ( 'fournisseur' , 'commande' , 'creer' );
2025-03-11 02:20:26 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
// Form to add record into a category
2025-03-16 19:45:04 +00:00
$showclassifyform = $user -> hasRight ( 'fournisseur' , 'commande' , 'creer' );
;
2025-03-11 02:20:26 +00:00
if ( $showclassifyform ) {
print '<br>' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-03-11 02:20:26 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddSupplierOrderIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'CommandeFournisseur:fourn/class/fournisseur.commande.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2025-03-11 02:20:26 +00:00
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-03-11 02:20:26 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
2025-03-16 19:45:04 +00:00
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ;
$num = count ( $objects );
$nbtotalofrecords = '' ;
$newcardbutton = '' ;
2025-03-11 02:20:26 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste ( $langs -> trans ( " SuppliersOrders " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'supplier_order' , 0 , $newcardbutton , '' , $limit );
print " <table class='noborder centpercent'> \n " ;
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
foreach ( $objects as $key => $supplier_order ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
print '<td class="nowrap tdtop">' ;
print $supplier_order -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $supplier_order -> ref . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-12-20 12:53:43 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . $typeid . " &action=unlink&token= " . newToken () . " &removeelem= " . $supplier_order -> id . " '> " ;
2025-03-11 02:20:26 +00:00
print $langs -> trans ( " DeleteFromCat " );
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
print " </a> " ;
}
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</td></tr>' ;
}
print " </table> \n " ;
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2025-03-11 02:20:26 +00:00
}
}
2025-03-25 15:28:51 +00:00
// List of Supplier Invoices
if ( $type == Categorie :: TYPE_SUPPLIER_INVOICE ) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php' ;
2025-09-18 14:26:38 +00:00
$permission = $user -> hasRight ( 'fournisseur' , 'facture' , 'creer' );
2025-03-25 15:28:51 +00:00
$objects = $object -> getObjectsInCateg ( $type , 0 , $limit , $offset );
if ( $objects < 0 ) {
dol_print_error ( $db , $object -> error , $object -> errors );
} else {
// Form to add record into a category
$showclassifyform = $user -> hasRight ( 'fournisseur' , 'facture' , 'creer' );;
if ( $showclassifyform ) {
print '<br>' ;
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-03-25 15:28:51 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="addintocategory">' ;
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre"><td>' ;
print $langs -> trans ( " AddSupplierInvoiceIntoCategory " ) . ' ' ;
2025-12-22 16:16:37 +00:00
print $form -> selectForForms ( 'FactureFournisseur:fourn/class/fournisseur.facture.class.php' , 'elemid' , 0 , 1 , '' , '' , 'maxwidth500' );
2025-03-25 15:28:51 +00:00
print '<input type="submit" class="button buttongen" value="' . $langs -> trans ( " ClassifyInCategory " ) . '"></td>' ;
print '</tr>' ;
print '</table>' ;
print '</form>' ;
}
2025-10-17 00:31:07 +00:00
print '<form method="post" action="' . dolBuildUrl ( $_SERVER [ " PHP_SELF " ]) . '">' ;
2025-03-25 15:28:51 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="typeid" value="' . $typeid . '">' ;
print '<input type="hidden" name="type" value="' . $typeid . '">' ;
print '<input type="hidden" name="id" value="' . $object -> id . '">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<br>' ;
$param = '&limit=' . $limit . '&id=' . $id . '&type=' . $type ; $num = count ( $objects ); $nbtotalofrecords = '' ; $newcardbutton = '' ;
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste ( $langs -> trans ( " SuppliersOrders " ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'supplier_order' , 0 , $newcardbutton , '' , $limit );
print " <table class='noborder centpercent'> \n " ;
print '<tr class="liste_titre"><td colspan="4">' . $langs -> trans ( " Ref " ) . '</td></tr>' . " \n " ;
if ( count ( $objects ) > 0 ) {
$i = 0 ;
foreach ( $objects as $key => $supplier_invoice ) {
$i ++ ;
if ( $i > $limit ) {
break ;
}
print " \t " . '<tr class="oddeven">' . " \n " ;
print '<td class="nowrap tdtop">' ;
print $supplier_invoice -> getNomUrl ( 1 );
print " </td> \n " ;
print '<td class="tdtop">' . $supplier_invoice -> ref . " </td> \n " ;
// Link to delete from category
print '<td class="right">' ;
if ( $permission ) {
2025-12-20 12:53:43 +00:00
print " <a href= ' " . $_SERVER [ 'PHP_SELF' ] . " ? " . ( empty ( $socid ) ? 'id' : 'socid' ) . " = " . $object -> id . " &type= " . $typeid . " &action=unlink&token= " . newToken () . " &removeelem= " . $supplier_invoice -> id . " '> " ;
2025-03-25 15:28:51 +00:00
print $langs -> trans ( " DeleteFromCat " );
print img_picto ( $langs -> trans ( " DeleteFromCat " ), 'unlink' , '' , 0 , 0 , 0 , '' , 'paddingleft' );
print " </a> " ;
}
print " </tr> \n " ;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs -> trans ( " ThisCategoryHasNoItems " ) . '</td></tr>' ;
}
print " </table> \n " ;
2025-11-08 13:01:19 +00:00
print " </form> \n " ;
2025-03-25 15:28:51 +00:00
}
}
2024-03-14 17:40:56 +00:00
// Note that $action and $object may have been modified by some hooks
$parameters = array ( 'type' => $type , 'id' => $id , 'label' => $label );
2024-03-14 21:32:18 +00:00
$reshook = $hookmanager -> executeHooks ( 'addMoreCategoriesList' , $parameters , $object , $action );
2024-03-14 17:40:56 +00:00
2018-07-29 11:40:35 +00:00
// End of page
2011-08-27 14:24:16 +00:00
llxFooter ();
2012-03-28 17:39:56 +00:00
$db -> close ();