diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 19e2e0ca00d..ae9ca936c47 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2022 Frédéric France * * 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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 93ac290e08c..c658916e359 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand + * Copyright (C) 2022 Frédéric France * * 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] .= ''.$nbExtrafields.''; + } $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] .= ''.$nbExtrafields.''; + } $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] .= ''.$nbExtrafields.''; + } $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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'supplierinvoicedet'; $h++; diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 4f6da9f6d51..eb0ca243c90 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2022 Frédéric France * * 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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 79d8ac57834..e919bf2c8b6 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 7f5c6e865de..e697908e8cb 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -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] .= ''.$nbExtrafields.''; + } $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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines_reception'; $h++; } diff --git a/htdocs/core/lib/supplier_proposal.lib.php b/htdocs/core/lib/supplier_proposal.lib.php index 3c9915bc951..11c0786802f 100644 --- a/htdocs/core/lib/supplier_proposal.lib.php +++ b/htdocs/core/lib/supplier_proposal.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2022 Frédéric France * * 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] .= ''.$nbExtrafields.''; + } $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] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; diff --git a/htdocs/install/doctemplates/proposals/template_proposal.odt b/htdocs/install/doctemplates/proposals/template_proposal.odt index 8ece83c989c..31981d8c120 100644 Binary files a/htdocs/install/doctemplates/proposals/template_proposal.odt and b/htdocs/install/doctemplates/proposals/template_proposal.odt differ diff --git a/htdocs/install/doctemplates/recruitment/template_recruitment.odt b/htdocs/install/doctemplates/recruitment/template_recruitment.odt new file mode 100644 index 00000000000..5955d47e206 Binary files /dev/null and b/htdocs/install/doctemplates/recruitment/template_recruitment.odt differ diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index 2f189b05f5c..d1de9e5e401 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -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] .= ''.$nbExtrafields.''; + } $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( diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 93897771019..5908b964f2c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -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'); diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index abf8dcca63b..5c30be6ffd1 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -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] .= ''.$nbExtrafields.''; + } $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( diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index dda796c243e..7a9d077f910 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2020 Laurent Destailleur +/* Copyright (C) 2022 Alexandre Spangaro * * 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)) { diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 38e1ead836e..cfbf91463e8 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -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;