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

This commit is contained in:
Laurent Destailleur 2022-12-01 10:48:23 +01:00
commit 7ac0afd568
13 changed files with 122 additions and 38 deletions

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -130,11 +131,14 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object)
*/
function expensereport_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$h = 0;
$head = array();
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('expensereport');
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport.php";
@ -162,6 +166,10 @@ function expensereport_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/expensereport_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['expensereport']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -249,7 +250,13 @@ function ordersupplier_prepare_head(CommandeFournisseur $object)
*/
function supplierorder_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('commande_fournisseur');
$extrafields->fetch_name_optionals_label('commande_fournisseurdet');
$extrafields->fetch_name_optionals_label('facture_fourn');
$extrafields->fetch_name_optionals_label('facture_fourn_det');
$h = 0;
$head = array();
@ -273,21 +280,37 @@ function supplierorder_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorder_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrders");
$nbExtrafields = $extrafields->attributes['commande_fournisseur']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierorder';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines");
$nbExtrafields = $extrafields->attributes['commande_fournisseurdet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierorderdet';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices");
$nbExtrafields = $extrafields->attributes['facture_fourn']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierinvoice';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines");
$nbExtrafields = $extrafields->attributes['facture_fourn_det']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'supplierinvoicedet';
$h++;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -18,7 +19,7 @@
/**
* \file htdocs/core/lib/holiday.lib.php
* \brief Ensemble de fonctions de base pour les adherents
* \brief base functions for holiday
*/
/**
@ -53,6 +54,8 @@ function holiday_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'core');
$head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
@ -62,7 +65,7 @@ function holiday_prepare_head($object)
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'add', 'external');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove');
@ -79,6 +82,9 @@ function holiday_admin_prepare_head()
{
global $db, $langs, $conf, $user;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('holiday');
$h = 0;
$head = array();
@ -95,6 +101,10 @@ function holiday_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/admin/holiday_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['holiday']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;

View File

@ -374,7 +374,10 @@ function product_admin_prepare_head()
*/
function product_lot_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('product_lot');
$h = 0;
$head = array();
@ -392,6 +395,10 @@ function product_lot_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_lot_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['product_lot']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;

View File

@ -110,9 +110,13 @@ function reception_prepare_head(Reception $object)
*/
function reception_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$langs->load("receptions");
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('reception');
$extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch');
$h = 0;
$head = array();
@ -126,6 +130,10 @@ function reception_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['reception']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes_reception';
$h++;
}
@ -133,6 +141,10 @@ function reception_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
$head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines_reception';
$h++;
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -110,7 +111,11 @@ function supplier_proposal_prepare_head($object)
*/
function supplier_proposal_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('supplier_proposal');
$extrafields->fetch_name_optionals_label('supplier_proposaldet');
$h = 0;
$head = array();
@ -128,11 +133,19 @@ function supplier_proposal_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposal_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['supplier_proposal']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/admin/supplier_proposaldet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['supplier_proposaldet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines';
$h++;

View File

@ -28,10 +28,13 @@
*/
function knowledgemanagementAdminPrepareHead()
{
global $langs, $conf;
global $langs, $conf, $db;
$langs->load("knowledgemanagement");
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('knowledgemanagement_knowledgerecord');
$h = 0;
$head = array();
@ -43,14 +46,13 @@ function knowledgemanagementAdminPrepareHead()
$head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['knowledgemanagement_knowledgerecord']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'extra';
$h++;
/*$head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/admin/about.php';
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;*/
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -17,18 +17,14 @@
*/
/**
* \file class/partnership.class.php
* \file htdocs/partnership/class/partnership.class.php
* \ingroup partnership
* \brief This file is a CRUD class file for Partnership (Create/Read/Update/Delete)
*/
use Illuminate\Support\Arr;
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/**
* Class for Partnership
@ -198,7 +194,7 @@ class Partnership extends CommonObject
$this->db = $db;
if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
} else {
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150');

View File

@ -28,10 +28,13 @@
*/
function partnershipAdminPrepareHead()
{
global $langs, $conf;
global $langs, $conf, $db;
$langs->loadLangs(array("members", "partnership"));
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('partnership');
$h = 0;
$head = array();
@ -43,6 +46,10 @@ function partnershipAdminPrepareHead()
$head[$h][0] = dol_buildpath("/partnership/admin/partnership_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['partnership']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'partnership_extrafields';
$h++;
@ -51,13 +58,6 @@ function partnershipAdminPrepareHead()
$head[$h][2] = 'website';
$h++;
/*
$head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
*/
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -62,10 +63,24 @@ class RecruitmentJobPosition extends CommonObject
*/
public $picto = 'recruitmentjobposition';
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated
*/
const STATUS_VALIDATED = 1;
/**
* Recruited
*/
const STATUS_RECRUITED = 3;
/**
* Canceled
*/
const STATUS_CANCELED = 9;
@ -651,7 +666,7 @@ class RecruitmentJobPosition extends CommonObject
}
/**
* Close the commercial proposal
* Close the recruitment
*
* @param User $user Object user that close
* @param int $status Statut
@ -683,12 +698,6 @@ class RecruitmentJobPosition extends CommonObject
if ($status == self::STATUS_RECRUITED) {
$triggerName = 'RECRUITMENTJOB_CLOSE_RECRUITED';
$modelpdf = $this->model_pdf;
if ($result < 0) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -2;
}
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@ -287,7 +287,11 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
dol_mkdir($conf->recruitment->dir_temp);
if (!is_writable($conf->recruitment->dir_temp)) {
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->recruitment->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}
// If CUSTOMER contact defined on order, we use it
$usecontact = false;