Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
ldestailleur
2025-02-16 14:50:09 +01:00
22 changed files with 63 additions and 54 deletions

View File

@@ -53,10 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$boxid = GETPOSTINT('boxid');
$boxorder = GETPOST('boxorder');
$zone = GETPOST('zone'); // Can be key for zone
if ($zone !== '') {
$zone = (int) $zone;
}
$zone = GETPOST('zone'); // Can be '0' or '1' or 'pagename'...
$userid = GETPOSTINT('userid');
// Security check
@@ -91,7 +88,7 @@ if ($boxorder && $zone != '' && $userid > 0) {
// boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B"
dol_syslog("AjaxBox boxorder=".$boxorder." zone=".$zone." userid=".$userid, LOG_DEBUG);
$result = InfoBox::saveboxorder($db, (int) $zone, $boxorder, $userid);
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) {
$langs->load("boxes");
if (!GETPOST('closing')) {

View File

@@ -10382,6 +10382,7 @@ abstract class CommonObject
$fieldvalues['date_creation'] = $this->db->idate($now);
$this->date_creation = $this->db->idate($now);
}
// For backward compatibility, if a property ->fk_user_creat exists and not filled.
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) {
$fieldvalues['fk_user_creat'] = $user->id;
$this->fk_user_creat = $user->id;

View File

@@ -218,7 +218,7 @@ class InfoBox
* Save order of boxes for area and user
*
* @param DoliDB $dbs Database handler
* @param int $zone Key of area (0 for Homepage, ...)
* @param int|string $zone Key of area ('0' for Homepage, '1', 'pagename', ...)
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @param int $userid Id of user
* @return int Return integer <0 if KO, 0=Nothing done, > 0 if OK
@@ -252,6 +252,10 @@ class InfoBox
return -3;
}
if (!is_numeric($zone)) {
$zone = '0'; // Force $zone to a numeric value string
}
// Delete all lines
$sql = "DELETE FROM ".$dbs->prefix()."boxes";
$sql .= " WHERE entity = ".$conf->entity;

View File

@@ -51,6 +51,10 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
dol_syslog("getURLContent postorget=".$postorget." URL=".$url." param=".$param);
if (!function_exists('curl_init')) {
return array('curl_error_no' => 'PHP curl lib not available', 'curl_error_msg' => 'PHP curl library must be installed');
}
//setting the curl parameters.
$ch = curl_init();

View File

@@ -182,13 +182,12 @@ class modAdherent extends DolibarrModules
[
"MEMBER_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/members",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/members",
"",
0,
],
];
// Boxes
//-------
$this->boxes = array(
@@ -439,8 +438,8 @@ class modAdherent extends DolibarrModules
// ODT template
/*
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/members/template_member.odt';
$dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/members';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest)) {

View File

@@ -128,7 +128,7 @@ class modBom extends DolibarrModules
$this->const = array(
1 => array('BOM_ADDON_PDF', 'chaine', 'generic_bom_odt', 'Name of PDF model of BOM', 0),
2 => array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0),
3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0)
3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms', '', 0)
);
// Some keys to add into the overwriting translation tables
@@ -480,7 +480,7 @@ class modBom extends DolibarrModules
// ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/boms/template_bom.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/boms';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms';
$dest = $dirodt.'/template_bom.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -87,7 +87,7 @@ class modContrat extends DolibarrModules
[
"CONTRACT_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/contracts",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/contracts",
"",
0,
],
@@ -231,7 +231,7 @@ class modContrat extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/contracts/template_contract.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/contracts';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/contracts';
$dest = $dirodt.'/template_contract.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -100,7 +100,7 @@ class modExpedition extends DolibarrModules
[
"EXPEDITION_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/shipments",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/shipments",
"",
0,
],
@@ -121,7 +121,7 @@ class modExpedition extends DolibarrModules
[
"DELIVERY_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/deliveries",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/deliveries",
"",
0,
],
@@ -133,6 +133,7 @@ class modExpedition extends DolibarrModules
0,
],
];
// Boxes
$this->boxes = array(
0 => array('file'=>'box_shipments.php', 'enabledbydefaulton'=>'Home'),
@@ -344,7 +345,7 @@ class modExpedition extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/shipments';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/shipments';
$dest = $dirodt.'/template_shipment.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -118,7 +118,7 @@ class modFournisseur extends DolibarrModules
// Add ability ODT for Supplier orders
$this->const[$r][0] = "SUPPLIER_ORDER_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_orders";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_orders";
$this->const[$r][3] = '';
$this->const[$r][4] = 0;
$r++;
@@ -126,7 +126,7 @@ class modFournisseur extends DolibarrModules
// Add ability ODT for Supplier Invoices
$this->const[$r][0] = "SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_invoices";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
@@ -973,7 +973,7 @@ class modFournisseur extends DolibarrModules
//ODT template for Supplier Orders
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_orders/template_supplier_order.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_orders';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_orders';
$dest = $dirodt.'/template_supplier_order.odt';
if (file_exists($src) && !file_exists($dest)) {
@@ -994,7 +994,7 @@ class modFournisseur extends DolibarrModules
//ODT template for Supplier Invoice
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_invoices/template_supplier_invoices.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_invoices';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_invoices';
$dest = $dirodt.'/template_supplier_invoices.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -111,7 +111,7 @@ class modHoliday extends DolibarrModules
$this->const[$r][0] = "HOLIDAY_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/holiday";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/holiday";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
@@ -308,7 +308,7 @@ class modHoliday extends DolibarrModules
//ODT template
/*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/holiday';
$dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/holiday';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest))

View File

@@ -138,7 +138,7 @@ class modMrp extends DolibarrModules
$this->const = array(
//1=>array('MRP_MO_ADDON_PDF', 'chaine', 'vinci', 'Name of default PDF model of MO', 0),
2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0)
3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps', '', 0)
);
// Some keys to add into the overwriting translation tables
@@ -534,7 +534,7 @@ class modMrp extends DolibarrModules
// ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/mrps';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps';
$dest = $dirodt.'/template_mo.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -92,7 +92,7 @@ class modProjet extends DolibarrModules
[
"PROJECT_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/projects",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/projects",
"",
0,
],
@@ -113,7 +113,7 @@ class modProjet extends DolibarrModules
[
"PROJECT_TASK_ADDON_PDF_ODT_PATH",
"chaine",
"DOL_DATA_ROOT/doctemplates/tasks",
"DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/tasks",
"",
0,
],
@@ -380,7 +380,7 @@ class modProjet extends DolibarrModules
//ODT template for project
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/projects';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/projects';
$dest = $dirodt.'/template_project.odt';
if (file_exists($src) && !file_exists($dest)) {
@@ -396,7 +396,7 @@ class modProjet extends DolibarrModules
//ODT template for tasks
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/tasks';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tasks';
$dest = $dirodt.'/template_task_summary.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -92,7 +92,7 @@ class modReception extends DolibarrModules
$this->const[$r][0] = "RECEPTION_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/receptions";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/receptions";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
@@ -267,7 +267,7 @@ class modReception extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/reception/template_reception.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/reception';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/reception';
$dest = $dirodt.'/template_reception.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -102,7 +102,7 @@ class modSociete extends DolibarrModules
$this->const[$r][0] = "COMPANY_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/thirdparties";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/thirdparties";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
@@ -1034,7 +1034,7 @@ class modSociete extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/thirdparties';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/thirdparties';
$dest = $dirodt.'/template_thirdparty.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -97,14 +97,14 @@ class modStock extends DolibarrModules
$r++;
$this->const[$r][0] = "STOCK_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/stocks";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/stocks";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "MOUVEMENT_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/stocks/movements";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/stocks/movements";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
@@ -554,7 +554,7 @@ class modStock extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/stocks/template_warehouse.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/stocks';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/stocks';
$dest = $dirodt.'/template_warehouse.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -93,7 +93,7 @@ class modSupplierProposal extends DolibarrModules
$this->const[$r][0] = "SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposals";
$this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_proposals";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
@@ -164,7 +164,7 @@ class modSupplierProposal extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposals/template_supplier_proposal.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_proposals';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_proposals';
$dest = $dirodt.'/template_supplier_proposal.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -110,7 +110,7 @@ class modTicket extends DolibarrModules
$this->const = array(
1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0),
2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0),
3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0),
3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0),
4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0),
5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0),
6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0),
@@ -414,7 +414,7 @@ class modTicket extends DolibarrModules
//ODT template
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tickets/template_ticket.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/tickets';
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tickets';
$dest = $dirodt.'/template_ticket.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -497,7 +497,7 @@ class modMyModule extends DolibarrModules
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_myobjects.odt';
if (file_exists($src) && !file_exists($dest)) {

View File

@@ -655,7 +655,7 @@ if (isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'read')) {
$db->free($resql);
if (empty($num)) {
$colspan = 4;
$colspan = 5;
if (isModEnabled('productbatch')) {
$colspan++;
}

View File

@@ -208,13 +208,15 @@ class Task extends CommonObjectLine
* @var int|string
*/
public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds)
/**
* @var int
*/
public $timespent_withhour; // 1 = we entered also start hours for timesheet line
public $timespent_withhour; // 0 or 1 = we have entered also start hours for timesheet line
/**
* @var int
*/
public $timespent_fk_user;
/**
* @var float
@@ -1656,10 +1658,9 @@ class Task extends CommonObjectLine
$timespent->fk_user = $this->timespent_fk_user;
$timespent->fk_product = $this->timespent_fk_product;
$timespent->note = $this->timespent_note;
$timespent->datec = $this->db->idate($now);
$timespent->datec = $now;
$result = $timespent->create($user);
if ($result > 0) {
$ret = $result;
$this->timespent_id = $result;

View File

@@ -189,7 +189,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_year = '';
$search_note = '';
$search_duration = '';
$search_value = '';
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
@@ -261,6 +260,7 @@ if ($action == 'addtimespent' && $user->hasRight('projet', 'time')) {
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timemonth"), GETPOSTINT("timeday"), GETPOSTINT("timeyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid");
$object->timespent_fk_product = GETPOSTINT("fk_product");
@@ -309,6 +309,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");
$object->timespent_fk_product = GETPOSTINT("fk_product");
@@ -338,6 +339,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");
$object->timespent_fk_product = GETPOSTINT("fk_product");

View File

@@ -52,7 +52,7 @@ if (empty($id) && empty($ref)) {
$id = $user->id;
}
$expand = $_COOKIE['virtualcard_expand'];
$expand = empty($_COOKIE['virtualcard_expand']) ? '' : $_COOKIE['virtualcard_expand'];
$object = new User($db);
if ($id > 0 || !empty($ref)) {